您的位置:首页 > 编程语言 > C语言/C++

c++中human* p = new man;p->Disp();题目

2012-05-21 22:15 204 查看
#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;

}

输出结果: human disp......

human over......
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: