- Base class pointer to derived object; if destroyed using delete, behavior unspecified
- Simple fix
- Declare base-class destructor virtual; makes derived-class destructors virtual
- Now, when delete used appropriate destructor called
- When derived-class object destroyed
- Derived-class destructor executes first
- Base-class destructor executes afterwards
- Constructors cannot be virtual
2004-07-29