- 编译问题:invalid new-expression of a
- Keil 编译汇编时出错 error: Invalid line
- invalid deployment target for -s
- invalid Swift parseable output m
- 微信小程序:access_token is invalid 40
- 解决ReactNative编译时Invalid escape s
- macos开发中遇到的问题
- Error:error: invalid linker name
- The executable was signed with i
- Sphinx 编译报错nonlocal open_cite_ta
1. 编译报错:invalid new-expression of abstract class type ‘×××ב
这个报错代表一个尝试在实例化一个抽象类,也就是说父类的接口中有纯虚函数在子类中没有实现;
举个例子来看,假如说父类定义成了一个接口,
class parent:
{
virtual ~parent();
virtual void func1() = 0;
};
子类定义成如下,
class child: public parent
{
child();
~child();
};
int main()
{
parent *test = new child();
};
这样编译就会报错,子类中必须要实现所有父类里面定义的纯虚函数(接口)
class child: public parent
{
child();
~child();
void func1() {}
}
网友评论