#include <iostream>
using namespace std;
class Animal
{
private:
string name;
public:
Animal()
{}
Animal(string name):name(name)
{}
virtual void perform()
{
cout << "" << endl;
}
};
class Lion:public Animal
{
private:
string progam;
public:
Lion(){}
Lion(string name,string n):Animal(name),progam(n)
{}
void perform()
{
cout << "狮子叫," << endl;
}
};
class Elephant:public Animal
{
private:
string progam;
public:
Elephant()
{}
Elephant(string name,string progam):Animal(name),progam(progam)
{}
void perform()
{
cout << "大象跳舞" << endl;
}
};
int main()
{
Lion a("狮子" ,"叫");
Elephant b("大象" ,"跳舞");
Animal *p;
p = &a;
p->perform();
p = &b;
p->perform();
return 0;
}