Код: Выделить всё
class Base {
public:
virtual ~Base(){}
};
class Derived : public Base
{
Derived* d;
public:
~Derived()
{
delete d;
}
Derived():d(NULL){}
};
int main()
{
Base* b = new Derived;
delete b;
return 0;
}
Подробнее здесь: https://stackoverflow.com/questions/266 ... uctor-call
Мобильная версия