title: C++ Creating an array of multiple derived classes
body: <p>I have a base class Student(), with two derived classes GradStudent() and UndergradStudent().</p>
  
  <p>The base class has a function called getInfo(), the two derived classes have their own getInfo() functions. </p>
  
  <p>The assignment is to create an array of student and store an object of each class in that array. I'm then to call getInfo() from each (Using the base class function's version for each), then call the getInfo() function from the two derived classes.</p>
  
  <p>For the life of me I can't figure out how to do this. Here's what I have so far:</p>
  
  <p>(I guess I should mention here, I cannot modify the base class)</p>
  
  <pre><code>    Student *classRoom[3];
  
      Student base ( "Jim", "Bean", 1111 );
      classRoom[0] = &amp;base;
  
      GradStudent test ( "Jack", "Daniels", 1234, 'M', "Art" );
      classRoom[1] = &amp;test;
  
      UndergradStudent ust1 ( "Johnny", "Walker", 1235, 1 );
      classRoom[2] = &amp;ust1;
  
      cout &lt;&lt; classRoom[1]-&gt;getInfo();
  </code></pre>
  
  <p>Can anyone point me in the right direction? I will say that the instructions specifically it has to be an array, so no vector solutions please (Still not familiar with them anyway). </p>