本文主要是介绍6.11啊啊啊啊啊啊啊,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
#include <iostream>
using namespace std;
class Animal{
public:
virtual void perform(){
cout << "讲解员巴拉巴拉" << endl;
}
};
class Lion:public Animal{
public:
virtual void perform(){
cout << "狮子在哈哈哈哈" << endl;
}
};
class Tiger:public Animal{
public:
virtual void perform(){
cout << "老虎在轰轰轰" << endl;
}
};
class Elephant:public Animal{
public:
virtual void perform(){
cout << "大象在玩泥巴" << endl;
}
};
int main()
{
Lion L;
Tiger T;
Elephant E;
Animal *p=&L;
p->perform();
p=&T;
p->perform();
p=&E;
p->perform();
return 0;
}
这篇关于6.11啊啊啊啊啊啊啊的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!