Page 1 of 1

C++ abstract base class destructor

Posted: Sat Jul 01, 2006 4:04 am
by Neo
Do abstract base classes need destructors?
Especially when all the derived classes have their own destructors?

Re:C++ abstract base class destructor

Posted: Sat Jul 01, 2006 5:49 am
by nick8325
Yes, otherwise the destructor of the derived class won't be called. It can be abstract, though, so

virtual ~BaseClass() = 0

or something like that will do.