#include <iostream>
using namespace std;
class Animal
{
public:
virtual void perfrom(){}
};
class Tgree: public Animal
{
public:
void perfrom()
{
cout << "老虎" << endl;
}
};
class Flse: public Animal
{
public:
void perfrom()
{
cout << "鱼" << endl;
}
};
int main()
{
Tgree g;
Flse f;
Animal *p = &g;
g.perfrom();
p = &f;
f.perfrom();
return 0;
}
6.11作业
最新推荐文章于 2024-07-22 09:38:37 发布