cannot allocate object of abstract type - but the class is not abstract! (C++)
<p>I'm doing a Systems Programming homework.
I have to implement a university.
I have a Course class, with child classes ComputerScience courses class, PG courses class, and Elective courses class.</p>

<pre><code>class Course{
 public:
  virtual void teach();
  virtual void reg(Student &amp;s)=0;
  std::string getName();
  std::string getDepartment();
  int getSemester();
  int getMinGrade();
  void addStudent(Student *s);
  void removeStudent(Student *s);
 protected:
  std::string _department;
  std::string _name;
  int _semester;
  int _minGrade;
  std::vector&lt;Student*&gt; studentsList;

 };

class CSCourse : public Course {
 public:
  CSCourse();
  CSCourse(std::string department, std::string name, int semester, int mingrade);
  ~CSCourse();
  std::string getName();
  std::string getDepartment();
  int getSemester();
  int getMinGrade();
  void addStudent(Student *s);
  void removeStudent(Student *s);


};
</code></pre>

<p>(PG courses and Elective courses child classes are the same)
In the functions in the Course class (which are not void, like getSemester and such..) I just do dynamic_cast to figure what type of course is it.</p>

<p>I am having this problem:</p>

<p>coursesVector is:</p>

<pre><code>std::vector&lt;Course*&gt; coursesVector
</code></pre>

<p>and dp variable is a string containing either CS, PG or Elective. In the main, I do this:</p>

<pre><code>    if(dp=="CS"){
        CSCourse *csCourse = new CSCourse(dp, name, semester, minGrade);
        coursesVector.push_back(csCourse);
    }
</code></pre>

<p>it gives me "Cannot allocate object of abstract type CS Course".
Same goes for PG and Elective!</p>

<p>But, in my definiton of hte class, CS course is not abstract!</p>
