E
ES Kim
The destructor of a base class should be virtual in order to
ensure that the correct sequence of destructors is called.
But how about if the derived class has no additional member?
For example,
class Base
{
public:
~Base() { }
/* declaration of other members */
};
class Derived : public Base { };
Base* b = new Derived;
delete b;
Is this undefined?
ensure that the correct sequence of destructors is called.
But how about if the derived class has no additional member?
For example,
class Base
{
public:
~Base() { }
/* declaration of other members */
};
class Derived : public Base { };
Base* b = new Derived;
delete b;
Is this undefined?