提示"cannot instantiate abstract class due to following members"?
来源:互联网 发布:淘宝宝贝自定义属性 编辑:程序博客网 时间:2024/05/16 10:15
提示"cannot instantiate abstract class due to following members"?
解决方法:从基类派生来的类,其中有需要子类实现的纯虚函数必须实现,如果用不着就在实现的时候写为空的
如 TaskBase.h中的类为基类
class CTaskBase{ private: /*1.需子类实现的纯虚函数*/ virtual bool OnTaskStart() = 0; virtual void OnTaskStop() = 0; virtual void OnDealReportTask(CVorxProto* pTask) = 0; virtual void OnDealQueryTask(CVorxProto* pTask) = 0; virtual void OnDealHeartReturn(CVorxProto* pTask) = 0; virtual void OnDealHeartQuery(CVorxProto* pTask) = 0;}当派生出一个类class CTaskDeal : public CTaskBase{ virtual bool OnTaskStart() = 0; virtual void OnTaskStop() = 0; virtual void OnDealReportTask(CVorxProto* pTask) = 0; virtual void OnDealQueryTask(CVorxProto* pTask) = 0; virtual void OnDealHeartReturn(CVorxProto* pTask) = 0; virtual void OnDealHeartQuery(CVorxProto* pTask) = 0;}这些个函数在CTaskDeal中的.cpp文件必须要实现即bool CMatrixAgent::OnTaskStart(){ m_thread.StartThread(); return true;}void CMatrixAgent::OnTaskStop(){ }void CMatrixAgent::OnDealReportTask(CVorxProto* pTask){ }void CMatrixAgent::OnDealQueryTask(CVorxProto* pTask){}void CMatrixAgent::OnDealHeartReturn(CVorxProto* pTask){}void CMatrixAgent::OnDealHeartQuery(CVorxProto* pTask){}
- 提示"cannot instantiate abstract class due to following members"?
- 提示"cannot instantiate abstract class due to following members"? .
- c++中的纯虚函数和提示"cannot instantiate abstract class due to following members"
- 类的继承引起的一个错误:error C2259 cannot instantiate abstract class due to following members
- 类的继承引起的一个错误:error C2259 cannot instantiate abstract class due to following members
- error C2259: 'CException' : cannot instantiate abstract class
- ArcServer10 安装中提示The following features cannot not be installed due to missing prerequisites"
- error C2259: 'CException' : cannot instantiate abstract class 2011.11.04
- Jira plugin cannot startup due to "Error parsing class file"
- Error 2259 : cannot instantiate abstract class with one or more pure virtual functions
- ::* (The pointers to class members)
- Retrieving the COM class factory for component with CLSID {xxxx} failed due to the following error:
- Controlling Access to Members of a Class
- Controlling Access to Members of a Class
- How to fix the bug: Retrieving the COM class factory for component with CLSID{00000000-...} faild due to the following error: 80
- failed due to the following error: 80070005解决办法. (转)
- failed due to the following error: 80070005解决办法
- Retrieving the COM class factory for component with CLSID {0002E55D-0000-0000-C000-000000000046} failed due to the following err
- 如何改变Android Progressbar默认颜色
- ERP 销售出库单查询---出库单明细 SQL优化
- 使用Win7时,出现无法切换电视墙
- 资料汇总
- JIN学习一、Android使用已有C/C++代码、第三方SO库的方法
- 提示"cannot instantiate abstract class due to following members"?
- JavaScript/jQuery WebIM 及时聊天通信工具 本地客户端
- 联想该收购Qt 的研发部
- SQL增删改查
- android.mk示例
- 实战 SSH 端口转发
- RemoteView概述
- GNU ARM汇编伪操作(Directives) 命令集
- CDialog::OnOk()作用