“Cannot allocate an object of abstract type” error

前端 未结 2 751
一向
一向 2020-12-30 20:37

Error is here:

vector graduates;
graduates.push_back(new AliceUniversity(identifier,id,salary,average));

Grandparent clas

2条回答
  •  一整个雨季
    2020-12-30 20:56

    You must have some virtual function declared in one of the parent classes and never implemented in any of the child classes. Make sure that all virtual functions are implemented somewhere in the inheritence chain. If a class's definition includes a pure virtual function that is never implemented, an instance of that class cannot ever be constructed.

提交回复
热议问题