Step 5 of 8
Virtual destructors
Without a virtual destructor, deleting a derived object through a base pointer only runs the base destructor. The derived part never gets cleaned up.
Your turn: the program should print:
+ base
+ derived
- derived
- base
but - derived is missing. Fix it with one keyword.
Previous: Polymorphic containers Next: Calling the base version, and protected