Announcements and Reminders
|
|
RecordingExercise 7 commentDefault arguments in the set function More Class ConceptsConstructors and DestructorsNotes
from CIS27
Constructors are special class member functions that are used to create class objects. They execute automatically when an instance of a class is created. Constructors are used to initialize class data members. They are also used to allocate memory for a class. A constructor’s name is the same as the class name. Destructors are functions that also execute automatically when the object goes out of scope (existence). Destructors, too, have a special name. It is the class name preceded by a ~ (tilde). Destructors are used to release dynamically allocated memory and to perform other "cleanup" activities. Example
Notes
Examples
Video |