C++ abstract base class destructor

All off topic discussions go here. Everything from the funny thing your cat did to your favorite tv shows. Non-programming computer questions are ok too.
Post Reply
User avatar
Neo
Member
Member
Posts: 842
Joined: Wed Oct 18, 2006 9:01 am

C++ abstract base class destructor

Post by Neo »

Do abstract base classes need destructors?
Especially when all the derived classes have their own destructors?
Only Human
nick8325
Member
Member
Posts: 200
Joined: Wed Oct 18, 2006 5:49 am

Re:C++ abstract base class destructor

Post 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.
Post Reply