18.4 Destructors
- Perform necessary housekeeping tasks
- Named ~ClassName, no arguments, no return type
- Implicitly called on:
- Local variables, at end of block
- Parameters, at end of function
- Temporary variables, at end of statement
- Heap values, when delete is called
- Static values, when main terminates
- Member data, when object is deallocated
- Base class object, when derived class object is deallocated
- Local variables, when an exception is thrown and execution leaves
the block
prev
|top
|next