I'm aware of the common problem...
Lets say B should not have been virtual & derived from; but it happened anyway.Code:class A { public: A(); ~A(); virtual void x(); }; class B: public A { public: B(); ~B(); virtual void x(); }; A* pA = new B; delete pA; //~B() never called;
Someone told me that declaring the destructor for A protected prevents inheritance at compile time... but wouldn't that disallow the object to be created altogether?
I'm a bit confused, could someone please shed some light on this?
Thanks




Reply With Quote