#include <iostream>
using namespace std;
class Role
{
public:
void eat(int z);
void beAttack();
void setRole(string nam, int b);
void attack();
void show();
private:
string name;
int blood;
bool life;
};
void Role::eat(int z)
{
blood=blood+z;
}
void Role::attack()
{
blood++;
}
void Role::beAttack()
{
blood--;
}
void Role::setRole(string nam, int b)
{
name=nam;
blood=b;
}
void Role::show()
{
cout<<name<<" has "<<blood<<" blood, it is ";
}
int main( )
{
Role mary;
mary.setRole("Mary", 4);
mary.show();
mary.attack();
mary.eat(2);
mary.beAttack();
mary.beAttack();
mary.show();
return 0;
}
using namespace std;
class Role
{
public:
void eat(int z);
void beAttack();
void setRole(string nam, int b);
void attack();
void show();
private:
string name;
int blood;
bool life;
};
void Role::eat(int z)
{
blood=blood+z;
}
void Role::attack()
{
blood++;
}
void Role::beAttack()
{
blood--;
}
void Role::setRole(string nam, int b)
{
name=nam;
blood=b;
}
void Role::show()
{
cout<<name<<" has "<<blood<<" blood, it is ";
}
int main( )
{
Role mary;
mary.setRole("Mary", 4);
mary.show();
mary.attack();
mary.eat(2);
mary.beAttack();
mary.beAttack();
mary.show();
return 0;
}