| < Day Day Up > |
|
Correct, predictable object behavior is essential for the successful implementation of an object-oriented software application. A well-behaved object is one that can be relied upon to perform as if it were a native C++ data type. The degree to which an object should perform like a native data type is context dependent.
When creating complex user-defined types you must be aware of the four primary object contexts: object creation, object copying, object assignment, and object destruction. The orthodox canonical class form (OCCF) can be used to ensure proper class design so that user-defined type objects behave predictably in the four basic object usage contexts.
Four special functions support the OCCF: default constructor, destructor, copy constructor, and copy assignment operator. Additional object usage contexts, such as object comparison, requires the overloading of additional operators. Keeping the OCCF in mind when you create complex user-defined types increases your object usage situational awareness.
| < Day Day Up > |
|