VC中虚函数的问题
代码如下
********CShape.h*****
抽象类
public:
///<计算调节手柄的位置
virtual void AdjustHandlePosition() = 0;
virtual void ResetPoint() = 0;
********CShapeRectangle.h******
是CShape的子类
CShapeRectangle(void);
///< 重载构造函数使得在交互器中的图形的开始与结束坐标能够传递到层中
CShapeRectangle(CPoint pStartPt,CPoint pEndPt);
~CShapeRectangle(void);
///<计算调节手柄的位置
virtual void AdjustHandlePosition();
*******CInteractor.CPP******
一个绘制类
#include "ShapeRectangle.h"
void CInteractor::test()
{
CShapeRectangle *pRectangle = new CShapeRectangle(m_PBeginPt,m_PAfterPt);
}
就是这句定义弹出如下错误
: error C2259: 'CShapeRectangle' : cannot instantiate abstract class
due to following members:
'void CShape::ResetPoint(void)' : pure virtual function was not defined
d:\workspace_lmr\newShape\Shape.h(44) : see declaration of 'CShape::ResetPoint'
这是为什么啊?