This is a FAQ, but I always forget the answer. The destructor for a
base class should be virtual whenever a derived-class object will be
destroyed by calling
delete on a base-class pointer.
As a rule of thumb, all classes that have at least another virtual method should have virtual destructors.
However, if a base class has a virtual destructor, all derived class automatically get virtual destructors.
© M. Vallisneri 2012 — last modified on 2010/01/29
Tantum in modicis, quantum in maximis