我正在开发一个视图继承 CFormView 的 SDI 项目。我试图覆盖CView::OnUpdate,但编译器抱怨如下:
'CMyFormView::OnUpdate' : 'virtual' storage-class specifier illegal on function
定义
这是我的类定义:
class CMyFormView : public CFormView
{
…
// Overrides
public:
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
virtual void OnInitialUpdate(); // called first time after construct
virtual void OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint);
};
我试图覆盖的函数如下所示:
virtual void CMyFormView::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint)
{
CFormView::OnUpdate(pSender, lHint, pHint);
//Get the current data from our document
CMyAppDoc* pDoc = GetDocument();
}
有人可以告诉我如何解决这个问题吗?