#include "stdafx.h"
#include <iostream>
using namespace std;
class human
{
public:
~human()
{
cout<< "human over......" <<endl;
}
void Disp()
{
cout <<"human disp......" <<endl;
}
};
class man : public human
{
public:
~man()
{
cout << "man over ......." <<endl;
}
void Disp()
{
cout << "man disp......." << endl;
}
};
int _tmain(int argc, _TCHAR* argv[])
{
human* p = new man;
p->Disp();
delete p;
return 0;
#include <iostream>
using namespace std;
class human
{
public:
~human()
{
cout<< "human over......" <<endl;
}
void Disp()
{
cout <<"human disp......" <<endl;
}
};
class man : public human
{
public:
~man()
{
cout << "man over ......." <<endl;
}
void Disp()
{
cout << "man disp......." << endl;
}
};
int _tmain(int argc, _TCHAR* argv[])
{
human* p = new man;
p->Disp();
delete p;
return 0;
}
输出结果: human disp......
human over......