回复 4楼 mmmmmmmmmmmm
就是像这样的
#include<iostream>
#include<string>
using namespace std;
class pig
{public:
virtual void pzsl()
{}
private:
string fur_color;
};
class wuglwhite:public pig
{public:
void pzsl ()
{cout<<"yumi+zhengdasiliao6jin"<<endl;
}};
class wuglblack:public pig
{
public:
void pzsl()
{cout<<"dami1jin+zhenghongsiliao3jin"<<endl;
}};
class shouroupig:public pig
{
public:voidpzsl()
{cout<<"tudou+yumi"<<endl;
}
};
void machine (pig*pg)
{pg->pzsl();}
void main()
{
wuglwhite xiaobai;
wuglblack heihei;
shouroupig shourou;
machine (&xiaobai);
machine (&heihei);
machine (&shourou);
}