title: C++ Creating Child Class from a Parent Class that's already been initialised
body: <p>I have a class "Player". Its members are simple strings and ints and I've got Getters and Setters for each of these...basic stuff: (there's a load of members so I've just given 3 to shrink the code):</p>
  
  <p><strong><em>PLAYER.H</em></strong></p>
  
  <pre><code>class Player
  {
  private:
  string Name;
  string Role;
      int FFDefence;
      ......etc
  
  public:
  //constructor function
  Player(
  string Name = "Not Stated",
  string vRole = "Not Stated",
      int vFFDefence = 0,
      ......etc
      )
  
  
  //Getter Functions
  string GetName() const;
  string GetRole() const;
      int GetFFDefence() const;
      .....etc
  
  //Setter Functions
  void SetName (string x);
  void SetRole(string x);
      void SetFFDefence(int x);
      ......etc
      };
  </code></pre>
  
  <p><strong><em>PLAYER.CPP</em></strong></p>
  
  <pre><code>Player::Player( string vName,
  string vRole,
  int vFFDefence,
  ......etc
  {
  Name = vName;
  Role = vRole;
  FFDefence = vFFDefence,
  ......etc
  }
  //getter functions
  string Player::GetName() const {return Name; };
  string Player::GetRole() const {return Role; };
  int Player::GetFFDefence() const {return FFDefence; };
  .....etc
  //Setter Functions
  void Player::SetName(string x) { Name = x ; };
  void Player::SetRole(string x) { Role = x ; };
  void Player::SetFFDefence(int x) { FFDefence = x ; };
  ......etc
  </code></pre>
  
  <p>So yeah - pretty bog standard......now I have a second class where one of the member functions is a Player Class itself.</p>
  
  <p><strong><em>BATTER.H</em></strong></p>
  
  <pre><code>class Batter
  {
  private:
  Player ID;
  int Touch;
  ....etc
  
  public:
  Batter(Player vID, int vTouch = 0....etc);
  //Getter Functions
  string GetRole() const;
      int GetFFDefence() const;
      int GetBFDefence() const;....and so on.
  </code></pre>
  
  <p>OK - that's the code out of the way!!!!</p>
  
  <p>So I've got it doing everything I want in terms of passing variables in and out....so I can create</p>
  
  <pre><code>Player Dave ("Dave", "Opener", 98, ....etc)
  </code></pre>
  
  <p>then later on (when I need it) create</p>
  
  <pre><code>Batter OnStrike (Dave, 10, .....etc)
  </code></pre>
  
  <p>All gravy....OK so I've started looking into inheritance and realized this is what I should be doing....back converting not a problem (did this with arrays and vectors the other day)...</p>
  
  <p>Here's my problem:</p>
  
  <p>With what I've got now, I can create "Player Dave" and then pass him into the subclass of Batter whenever I need to. How do I do the same with traditional inheritance? How do I take a specific instance (already created) of Player and use that as the parent for a specific instance of the child class Batter? As far as I can deduce at the moment, you need to create both at the same time.</p>