MFC虚基类声明问题
想创建一个虚基类,后续所有累类都从这个类来继承,我自己的虚基类创建过程如下:
1。建立一个MFC类,继承CWinThread
2.新建类中添加成员变量,然后编译,成功!
3.增加纯虚函数Process()之后报错error C2259 cannot instantiate abstract class due to following members。 代码如下:
class CBaseThread : public CWinThread
{
DECLARE_DYNCREATE(CBaseThread)
protected:
CBaseThread(); // protected constructor used by dynamic creation
// Attributes
public:
// Operations
public:
static HANDLE m_hAnOtherDead;
HANDLE m_hEventDead;
HANDLE m_hEventKill;
static CRITICAL_SECTION m_csNumLock;
virtual int Process() = 0;
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CBaseThread)
public:
virtual BOOL InitInstance();
virtual int ExitInstance();
//}}AFX_VIRTUAL
// Implementation
protected:
virtual ~CBaseThread();
// Generated message map functions
//{{AFX_MSG(CBaseThread)
// NOTE - the ClassWizard will add and remove member functions here.
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
添加蓝色部分不报错,添加红色部分就会报错
error C2259: 'CBaseThread' : cannot instantiate abstract class due to following members:
d:\vc6projects\cfilemake\basethread.h(15) : see declaration of 'CBaseThread'
我用的是VC6.0
跪求大神解决!