C++ 程序出现error: cannot allocate an object of abstract type
天蓬老师
天蓬老师 2017-04-17 11:19:42
0
1
800

一个基类,基类里面有个虚函数,一个子类实现了这个虚函数,但是在new这个子类的时候报如上题目这样的错误。

天蓬老师
天蓬老师

欢迎选择我的课程,让我们一起见证您的进步~~

reply all(1)
阿神

Virtual functions declared in the base class must be inherited and implemented in the derived class. This error will not be reported when new is a derived class. I carefully reviewed the code and found that one parameter of the virtual function in the base class has const, but not in the subclass. This is an error. Modify it to make the parameters consistent. That's it.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template