#include <iostream>
using namespace std;
class Animal
{
public:
Animal() {}
virtual void perform()=0;
};
class Lion:public Animal
{
public:
Lion() {}
void perform()
{
cout << "狮子会吃小朋友!!!快跑!!!" << endl;
}
};
class Elephant:public Animal
{
public:
Elephant() {}
void perform()
{
cout << "大象会用鼻子跳绳!!!" << endl;
}
};
class Monkey:public Animal
{
public:
Monkey() {}
void perform()
{
cout << "猴子会撑杆跳,还会抢走你的包!!!" << endl;
}
};
int main()
{
Animal *a1;
Lion p1;
Elephant p2;
Monkey p3;
a1=&p1;
a1->perform();
a1=&p2;
a1->perform();
a1=&p3;
a1->perform();
return 0;
}