title: Pointer to an array of pointers, each being able to hold an object
body: <p>I am struggling with a CSC assignment right now. I can't understand what this is supposed to mean:</p>
  <p><em>videoGamesArray – a pointer to an array of pointers.  Each pointer in the array should be able to point to (hold the memory address of) an individual Video game object.</em></p>
  <p>I have a VideoGameLibrary class, which should hold VideoGame objects, which is another class. However, I'm not sure how I'm supposed to incorporate the pointer to an array of pointers.</p>
  <p>VideoGameLibrary class:</p>
  <pre><code>class VideoGameLibrary {
      
  public:
      VideoGameLibrary** videoGamesArray;
      int maxGames;
      int numGames;
      
      VideoGameLibrary() {
          VideoGameLibrary* createGames(int);
      }
      ~VideoGameLibrary() {
          VideoGameLibrary* destroyGames(VideoGame*);
      }
      
      int getMaxGames();
      int getNumGames();
      
  };
  </code></pre>
  <p>VideoGame class:</p>
  <pre><code>class VideoGame {
      
  public:
      Text* gameTitle;
      Text* gamePlatform;
      int gameYear;
      Text* gameGenre;
      Text* ageRating;
      Text* userRating;
      
      VideoGame() {
          VideoGame* createVideoGame(Text*, Text*, int, Text*, Text*, int);
      }
      ~VideoGame() {
          void destroyVideoGame(VideoGame*);
      }
      
      Text* getVideoGameTitle();
      
  };
  </code></pre>
  <p>However, once I've created a videoGame object, I am supposed to dynamically allocate it into the VideoGameLibrary class/array of pointers. I also have to find a way to check if the number of maxGames has been hit and if it has, then I create a new VideoGameLibrary and reallocate it with double the size and all of the old objects into the new one. Hopefully this makes sense.</p>
  <pre><code>void addVideoGameToArray() {
      Text* title;
      Text* platform;
      Text* genre;
      Text* ageRating;
      int year;
      int userRating;
      char tempStr[200];
      
      cout &lt;&lt; endl;
      cout &lt;&lt; right &lt;&lt; setw(30) &lt;&lt; &quot;Video Game TITLE: &quot; &lt;&lt; left;
      cin.getline(tempStr, 200);
      title = createText(tempStr);
      
      cout &lt;&lt; endl;
      cout &lt;&lt; right &lt;&lt; setw(30) &lt;&lt; &quot;Video Game PLATFORM: &quot; &lt;&lt; left;
      cin.getline(tempStr, 200);
      platform = createText(tempStr);
      
      cout &lt;&lt; endl;
      cout &lt;&lt; right &lt;&lt; setw(30) &lt;&lt; &quot;Video Game YEAR: &quot; &lt;&lt; left;
      cin &gt;&gt; year;
      cin.ignore();
      
      cout &lt;&lt; endl;
      cout &lt;&lt; right &lt;&lt; setw(30) &lt;&lt; &quot;Video Game GENRE: &quot; &lt;&lt; left;
      cin.getline(tempStr, 200);
      genre = createText(tempStr);
      
      cout &lt;&lt; endl;
      cout &lt;&lt; right &lt;&lt; setw(30) &lt;&lt; &quot;Video Game AGE RATING: &quot; &lt;&lt; left;
      cin.getline(tempStr, 200);
      ageRating = createText(tempStr);
      
      cout &lt;&lt; endl;
      cout &lt;&lt; right &lt;&lt; setw(30) &lt;&lt; &quot;Video Game USER RATING: &quot; &lt;&lt; left;
      cin &gt;&gt; userRating;
      cin.ignore();
      cout &lt;&lt; endl;
      
      VideoGame* game = createVideoGame(title, platform, year, genre, ageRating, userRating);
      
  }
  </code></pre>
  <p>^ This is my function to create a VideoGame object. I'm stuck at adding it to the array.</p>