Polymorphism Tutorial Polymorphism Tutorial in OOP for C++ with VTABLE Proof in ASM
Posted 26 October 2010 - 01:43 PM
Base classes at the top of a class hierarchy must always have a virtual destructor. This is necessary to ensure proper cleanup of child classes upon their destruction.
It is untrue that a base class must always have a virtual destructor. See http://blogs.msdn.co.../07/127826.aspx
Posted 26 October 2010 - 11:15 PM
It is a common interview question, I think it is good to have all the facts relating to virtual destructors and not to pretend it is always right when in reality it is just a rule of thumb, as you say. The tutorial presented it as a rule of thumb which is great, I just wanted to clarify for anyone reading the comments.
This post has been edited by oscode: 26 October 2010 - 11:18 PM