I have three (C++) classes: Player, Hand, and Card.
Player has a member, hand, that holds a Hand. It also has a method, getHand(), that returns the contents of hand.
Hand Player::getHand() {
return hand;
}
Hand has a method, addCard(Card c), that adds a card to the hand.
I want to do this:
player1.getHand().addCard(c);
but it doesn't work. It doesn't throw an error, so it's doing something. But if I examine the contents of player1's hand afterward, the card hasn't been added.
How can I get this to work?