Virtual destructor

Hello!

Me class derives from class, which doesn't provide virtual destructor. I declared virtual destructor in my class. Would object destruction work the same as in class derive from class with virtual destruction?
No.
If Base does not have a virtual destructor and Derived (derived from Base) does, then
you can safely destroy a Derived object through a Derived object pointer but not
through a Base object pointer.

However in practice you shouldn't take advantage of this behavior; it is best for
maintainability (not just yourself, but other programmers) to add an empty virtual
destructor to the base class.
Topic archived. No new replies allowed.