#include <iostream>
#include <string>
using namespace std;
class Actor
{
protected:
int health;
int damage;
string name;
public:
Actor (string name = "Actor")
{
health = damage = 0;
this->name = name;
}
void setParam(const int &health, const int &damage)
{
this->health = health;
this->damage = damage;
}
void showStates()
{
cout << this->name << "\n\rHealth: " << this->health
<< ", damage: " << this->damage << endl;
}
void Attack(Actor *destination)
{
destination->health -= this->damage;
}
};
class Player : public Actor
{
public:
Player (string name) : Actor(name) { }
};
class Enemy : public Actor
{
public:
Enemy (string name) : Actor(name) { }
};
int main()
{
Player player("Player");
Enemy enemy("Enemy");
player.setParam(100, 50);
enemy.setParam(100,30);
player.showStates();
enemy.showStates();
player.Attack(&enemy);
player.showStates();
enemy.showStates();
}