title: cannot allocate an object of abstract type solution?
body: <p>I have a homework in C++ to program a university.
  I have two main abstract classes Student and Course.
  In the Course, there are different child classes, such as SoftwareEngineering class... etc
  In the Student, there are different child classes, such as SoftwareEngineering student class.. etc.</p>
  
  <p>Now, in the Course child classes, each child class has a function to register a student </p>
  
  <pre><code>void register(Student &amp;s);
  </code></pre>
  
  <p>When I call the function register of each course child class ( such as the software engineering course class), I want to push that student reference into a vector.
  But I get the error </p>
  
  <pre><code> cannot allocate an object of abstract type 'Student'
  </code></pre>
  
  <p>the Student class IS abstract, and has child classes SoftwareEngineeringStudent and such.
  But I -must- make the register function get an abstract object Student, not a specific type of student like SoftwareEngineeringStudent.</p>
  
  <p>Is there a possible way around this?</p>
  
  <p>here's a skeleton (not full code, of course!):</p>
  
  <pre><code>//Course.h
  class Course{
  virtual void reg(Student &amp;s)=0
  
  }
  class SoftwareEngCourse : public Course{
  void reg(Student &amp;s);
  }
  
  //Student.h
  class Student{
  virtual void study(Course &amp;c)=0;
  }
  class SoftwareEngStudent : public Student{
  void study(Course &amp;c);
  }
  </code></pre>
  
  <p>now in the Course.cpp:</p>
  
  <pre><code>//Course.cpp
  void SoftwareEngCourse::reg(Student &amp;s){
     vector_of_Student_object.push_back(s);
  }
  </code></pre>