
3 May
2008
3 May
'08
8:13 p.m.
Stefan Seefeld:
How do you prevent then any users deriving from your classes, from adding their own destructors ? Their destructors might not be invoked, since the base destructor isn't virtual.
How does this look in code?
struct A { ~A() {} // non-virtual virtual void foo() {} }; struct B : A { ~B() {} void foo() {} }; /////////// A* a = new B; delete a; // doesn't call ~B(), but should Regards Hartmut