为什么不能继承CView类
写了一个CmView类并继承CView类
<<<<<<<<<<CmView.h>>>>>>>>>
#pragma once
class CmView : public CView
{
DECLARE_DYNCREATE(CmView)
protected:
CmView();
virtual ~CmView();
public:
virtual void OnDraw(CDC* pDC);
#ifdef _DEBUG
virtual void AssertValid() const;
#ifndef _WIN32_WCE
virtual void Dump(CDumpContext& dc) const;
#endif
#endif
};
<<<<<<<<<<<CmView.Cpp>>>>>>>>>>>
#include "stdafx.h"
#include "CmView.h"
IMPLEMENT_DYNCREATE(CmView, CView)
CmView::CmView()
{}
CmView::~CmView()
{}
void CmView::OnDraw(CDC* pDC)
{
CDocument* pDoc = GetDocument();
}
#ifdef _DEBUG
void CmView::AssertValid() const
{
CView::AssertValid();
}
#ifndef _WIN32_WCE
void CmView::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
#endif
#endif //_DEBUG
现写了一个继承CmView类
<<<<<<<<<<LeftWnd.h>>>>>>>>>>
#pragma once
#include "CmView.h"
class LeftWnd : public CmView
{
DECLARE_DYNCREATE(LeftWnd)
protected:
LeftWnd();
virtual ~LeftWnd();
public:
virtual void OnDraw(CDC* pDC);
#ifdef _DEBUG
virtual void AssertValid() const;
#ifndef _WIN32_WCE
virtual void Dump(CDumpContext& dc) const;
#endif
#endif
};
<<<<<<<<<<<<<<<LeftWnd.Cpp>>>>>>>>>>>
#include "stdafx.h"
#include "Test.h"
#include "LeftWnd.h"
IMPLEMENT_DYNCREATE(LeftWnd, CmView)
LeftWnd::LeftWnd()
{
}
LeftWnd::~LeftWnd()
{
}
void LeftWnd::OnDraw(CDC* pDC)
{
CDocument* pDoc = GetDocument();
}
#ifdef _DEBUG
void LeftWnd::AssertValid() const
{
CmView::AssertValid();
}
#ifndef _WIN32_WCE
void LeftWnd::Dump(CDumpContext& dc) const
{
CmView::Dump(dc);
}
#endif
#endif //_DEBUG
编译没有报错,但是运行后报错,错那了
谢谢:)