#include <iostream>
#include<string>using namespace std;
class Role
{
public:
void setRole(string Name,int Blood)
{
name=Name;
blood=Blood;
}
void attack()
{
blood++;
}
void beAttacked()
{
blood--;
}
void eat(int b)
{
blood=blood+b;
}
void show()
{
if (blood==0)
cout<<name<<" : 死亡 "<<endl;
else
cout<<name<<" 剩余 "<<blood<<" 滴血"<<endl;
}
private:
string name;
int blood;
};
int main()
{
Role mary;
mary.setRole("Mary",1);
mary.show();
mary.attack();
mary.eat(0);
mary.beAttacked();
mary.beAttacked();
mary.show();
mary.attack();
mary.eat(2);
mary.show();
return 0;
}