I have three classes (C ++): Player, Hand and Card.
The player has a member, a hand that holds the Hand. It also has a getHand () method that returns the contents of the hand.
Hand Player::getHand() {
return hand;
}
The hand has an addCard method (Card c), which adds a card to the hand.
I want to do this:
player1.getHand () addCard (s) ;.
but that will not work. It does not throw errors, therefore does something. But if I examine the contents of player’s hand1, a card will not be added.
How can I make this work?
source
share