Should every class have a virtual destructor?
问题 Java and C# support the notion of classes that can't be used as base classes with the final and sealed keywords. In C++ however there is no good way to prevent a class from being derived from which leaves the class's author with a dilemma, should every class have a virtual destructor or not? Edit: Since C++11 this is no longer true, you can specify that a class is final. On the one hand giving an object a virtual destructor means it will have a vtable and therefore consume 4 (or 8 on 64 bit