Привет, сообщество C ++!
Я новичок в C ++, у меня есть этот пример кода:
class Player
{
public:
int pdamage;
int phealth;
/* ... other data members and some void member functions (getName etc.) */
};
class Ennemy
{
public:
int edamage;
int ehealth;
};
**/*here i would like to use current objects parameters for calculation and return to current player instance(current player object) the health value.*/**
int playerHit(this.Player.damage,this.Enemy.ehealth)
{
ehealth = this.Ennemy.ehealth - this.Player.damage;
return ehealth;
};
int ennemyHit(this.Player.phealth,this.Enemy.edamage)
{
phealth = this.Player.phealth - this.Ennemy.edamage ;
return ehealth;
};
int main()
{
/*....*/
return 0;
}
Возвращаясь к сообщению вопрос:
Как использовать текущие параметры объекта в функции для расчетов?
/ * Поскольку я новичок в stackoverflow и C ++, спасибо за все советы, предложения и критику! * /