Here is one of my class's.
Code:
class Player {
public:
// Function to get private variables
void setPlayer();
void setStats();
void setExp();
int setPlvl(); // Plvl = players current level
private:
int BaseStr;
int Strength;
int BaseMagic;
int Magic;
int BaseHealth;
int Health;
int EXP;
int Plvl;
string Race;
string Type;
string Name;
};
What I having problems thinking about is how I should declare Plvl (Player level) and EXP (expeirence). Both of these variables are going to have to be modified from outside of the class. Here is a hypothetical class, where the variables from the Player Class will be modified:
Code:
class Monster
{
public:
...
...
int getEXPgiven();
private:
int EXPgiven;
}
int Monster::getEXPgiven()
{
/*some formula*/ = EXPgiven;
return EXPgiven; // Not sure about this
}
Would it be best for me to just pass the EXPgiven variable from class Monster as a parameter to class Player::setExp ? Would sending the parameter to a function in another class work?