Yea I see what you mean. When you are using
Code:
void Player::getTreasure() {
health++; // increments the value of the player's health by one
}
It will give all players Treasure
But when you use
Code:
void Player.greenHat::getTreasure() {
health++; // increments the value of the player's health by one
}
You are giving just the greenHat players treasure.
The book should have wrote this
Code:
void Player.greenHat::getTreasure() {
health++; // increments the value of all player's health by one
}
Code:
void Player.greenHat::getTreasure() {
health++; // increments the value of the greenHat player's health by one
}