title: Calling the base class constructor from the derived class constructor
body: <p>I have a question:</p>
  <p>Say I have originally these classes which I can't change (let's say because they're taken from a library which I'm using):</p>
  <pre><code>class Animal_
  {
  public:
      Animal_();
      int getIdA()
      {
          return idA;
      };
      string getNameA()
      {
          return nameA;
      }
  private:
      string nameA;
      int idA;
  }
  
  class Farm
  {
  public :
      Farm()
      {
          sizeF=0;
      }
      Animal_* getAnimal_(int i)
      {
          return animals_[i];
      }
      void addAnimal_(Animal_* newAnimal)
      {
          animals_[sizeF]=newAnimal;
          sizeF++;
      }
      
  private:
      int sizeF;
      Animal_* animals_[max];
  }
  </code></pre>
  <p>But then I needed a class where I just add couple of fields so I did this:</p>
  <pre><code>class PetStore : public Farm
  {
  public :
      PetStore()
      {
       idF=0;
      };
  private:
      int idF;
      string nameF;
  }
  </code></pre>
  <p>However, I can't initialize my derived class. I mean I did this Inheritance so I can add <code>animals</code> to my <code>PetStore</code> but now since <code>sizeF</code> is private how can I do that? I'm thinking maybe in the <code>PetStore</code> default constructor I can call <code>Farm()</code>... so any idea?</p>