class hero
{
protected:
char name[128];
double blood;
public:
virtual double attack_crystal()=0;
hero(char* n,double b)
{
strcpy(name,n);
blood=b;
}
virtual ~hero(){};
};
class tank:public hero
{
protected:
double attack;
public:
double attack_crystal()
{
double health;
health=100+attack;
cout<<health<<endl;
return health;
}
tank(char* n,double b,double a):hero(n,b),attack(a){};
~tank(){};
};
class assassin:public hero
{
protected:
double discipline;
public:
double attack_crystal()
{
double health;
health=100+discipline;
cout<<health<<endl;
return health;
}
assassin(char* n,double b,double d):hero(n,b),discipline(d){};
~assassin(){};
};
void fun(hero& h)
{
h.attack_crystal();
}
int main()
{
tank k("aaa",100,90);
assassin s("bbb",100,100);
fun(k);
fun(s);
}