How to use another classes member variables in c++?

Posted by Stephen on Stack Overflow See other posts from Stack Overflow or by Stephen
Published on 2011-01-06T00:27:24Z Indexed on 2011/01/06 0:53 UTC
Read the original article Hit count: 108

Filed under:
|

Hi there

I'm currently programming a Yahtzee game, and I'm having trouble with some of my classes

I have two classes, Player, and Scorecard.

class Player {
  private:
    string name;
    Scorecard scorecard;
};


class Scorecard {
  public:
    void display() {
      //...
    }
};

(All the classes have the appropriate getters and setters)

I'd like the scorecard class to be able to display the name of the player to the user. Is there any way that can be done?

© Stack Overflow or respective owner

Related posts about c++

Related posts about class