#include<iostream>
using namespace std;
class base
{
public:
base(){};
virtual ~base(){};
};
// 在类声明中声明纯虚析构函数
//base::~base() {}
class father: public base
{
public:
~father(){
cout << "father" << endl;
}
};
int main()
{
base* a;
a=new father();
delete a;
}
#include<iostream>
using namespace std;
class base
{
public:
base(){};
~base(){};
};
// 在类声明中声明纯虚析构函数
//base::~base() {}
class father: public base
{
public:
~father(){
cout << "father" << endl;
}
};
int main()
{
base* a;
a=new father();
delete a;
}