我将基类析构函数定义为“虚拟”。例如:-
class Base
{
public:
virtual ~Base()
{
cout << "Calling ~Base()" << endl;
}
};
并且也在派生类中例如:例如:-
class Derived: public Base
{
public:
virtual ~Derived()
{
cout << "Calling ~Derived()" << endl;
}
};
我的问题是在删除指向派生类对象的基类指针时如何调用两个析构函数。??????? 谢谢..,