title: Array of derived class stored in parent class
body: <p>I don't think I quite understand how to store an array of a derived class in its parent class.
  I keep getting errors</p>
  
  <blockquote>
    <p>Error C3646   'list': unknown override specifier<br>
    Error C2065   'list': undeclared identifier</p>
  </blockquote>
  
  <p>Here is the code I have</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;string&gt;
  using namespace std;
  
  class GameScores
  {
  public:
      GameEntry list[9];
      void inputList(GameEntry x);
      void sortList();
      void removeList(int r);
      void printList();
      GameScores();
  };
  
  class GameEntry :public GameScores
  {
  public:
      GameEntry(const string&amp; n = "", int s = 0, const string d = "1/1/99");
      string getName() const;
      int getScore() const;
      string getDate() const;
      string setName(string n);
      int setScore(int s);
      string setDate(string d);
  
  private:
      string name;
      int score;
      string date;
  };
  
  GameScores::GameScores()
  {
      GameEntry list[9];
  }
  
  void GameScores::inputList(GameEntry x)
  {
      for (int i = 0; i &lt; 10; i++)
          if (x.getScore() &gt;= list[i].getScore())
          {
              list[i + 1] = list[i];
              list[i] = x;
          }
  }
  
  void GameScores::sortList()
  {
      GameEntry swap;
  
      for (int i = 0; i &lt; 10; i++)
      {
          for (int j = 0; j &lt; 10 - 1; j++)
          {
              if (list[j].getScore() &gt; list[j].getScore() + 1)
              {
                  swap = list[j];
                  list[j] = list[j + 1];
                  list[j + 1] = swap;
              }
          }
      }
  }
  
  void GameScores::removeList(int r)
  {
      for (int i = r; i &lt; 10; i++)
      list[i - 1] = list[i];
  
      list[9].setScore(0);
      list[9].setName(" ");
      list[9].setDate(" ");
  }
  
  void GameScores::printList()
  {
      cout &lt;&lt; "Top Scores" &lt;&lt; endl;
  
      for (int i = 0; i &lt; 10; i++)
          cout &lt;&lt; list[i].getScore() &lt;&lt; " " &lt;&lt; list[i].getName() &lt;&lt; " " &lt;&lt; list[i].getDate() &lt;&lt; endl;
  }
  
  GameEntry::GameEntry(const string&amp; n, int s, const string d)    // constructor
      : name(n), score(s), date(d) { }
                                                                  // accessors
  string GameEntry::getName() const { return name; }
  int GameEntry::getScore() const { return score; }
  string GameEntry::getDate() const { return date; }
  
  string GameEntry::setName(string n)
  {
      name = n;
  }
  
  int GameEntry::setScore(int s)
  {
      score = s;
  }
  ;
  string GameEntry::setDate(string d)
  {
      date = d;
  }
  
  int main()
  {
      GameEntry p1("John", 90, "9/9/98"), p2("Jane", 95, 8/21/98), p3("Bob", 60, "7/11/99"), p4("Jo", 92, "6/4/97");
  
      GameScores topScores;
      topScores.inputList(p1);
      topScores.inputList(p2);
      topScores.inputList(p3);
      topScores.inputList(p4);
      topScores.printList();
  
      return 0;
  }
  </code></pre>