| | | | | |

Constructors and Destructors

  • Constructors (including Copy Constructor):
    1. Derived class constructor implementation should call parent class constructor
    2. Make call explicit in initialization list
    3. Calling order: bottom-up
    4. Execution order: top-down
  • Destructors:
    1. No explicit call to base class destructor
    2. Called automatically as variable departs scope
    3. Calling order: bottom-up
    4. Execution order: bottom-up
  • Code Example

| | Top of Page | 8. C++ Classes Part 3: Inheritance - 6 of 16