Function
◀ Traps and Tips▶ Precondition and Postcondition Amazon
Daniel and Sharon were having a fight over an electronic calculator.
“You airhead! How can you use a calculator without putting in batteries?”
“How would I know? I thought pushing the On/Off button was all it needed.”
“I can’t believe you don’t know putting in batteries is the precondition for the calculator to function.”
“Okay, okay, there won’t be a next time.”
So you see, preserving preconditions is important to make a function work.There are two types of functions:
member functions and
nonmember functions.
Member functions refer to the functions that are associated with a class and nonmember functions are defined as independent entities. In this chapter when I say function I refer to either type of function unless otherwise specified.
In this chapter we will be discussing points related to C++ functions that you need to be aware of in order to use functions effectively!
◀ Traps and Tips▶ Precondition and Postcondition