December 2003
Beginner
288 pages
7h 8m
English
When designing a class, one of the most important design issues involves how the class will be constructed. Constructors are discussed in Chapter 3, “Advanced Object-Oriented Concepts.” Revisit this discussion if you need a refresher on guidelines for designing constructors.
First and foremost, a constructor should put an object into a safe state. This includes issues such as attribute initialization and memory management. Scott Meyers discusses some of these issues in the section “Constructors, Destructors and Assignment Operators” of Effective C++. You also need to make sure the object is constructed properly in the default condition. It is normally a good idea to provide a constructor ...
Read now
Unlock full access