继承类出现问题:程序是doc/view框架的 ,要创建分割窗口
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext) 
{
// TODO: Add your specialized code here and/or call the base class
if (m_spliterWnd.CreateStatic(this,1,2)==NULL)
return FALSE;
   
m_spliterWnd.CreateView(0,0,RUNTIME_CLASS(CLeftView),CSize(100,100) ,pContext);
    // 以下语句出错
    m_spliterWnd.CreateView(0,1,RUNTIME_CLASS(CRightView),CSize(100,100) ,pContext);

return TRUE;}
CRightView  在头文件中是这样定义的: class CRightView  :public CPropertyView
.......
出错提示:
   error C2039: 'classCRightView' : is not a member of 'CRightView'
若将'CRightView' 改为它的基类 CPropertyView ,通过。
为何 如何解决??

解决方案 »

  1.   

    .h中
    class CRightView : public CPropertyView 
    {
    DECLARE_DYNAMIC(CRightView)

    public:
    CRightView();
    virtual ~CRightView();
    //{{AFX_MSG(CRightView)
    //}}AFX_MSG
    DECLARE_MESSAGE_MAP()

    };
    .cpp中
    IMPLEMENT_DYNAMIC(CRightView, CPropertyView )
    BEGIN_MESSAGE_MAP(CRightView, CPropertyView )
    //{{AFX_MSG_MAP(CLeftView)
    //}}AFX_MSG_MAP
    END_MESSAGE_MAP()
    缺少CRuntimeclass的运行宏定义
      

  2.   

    .h文件中没有调用DECLARE_DYNAMIC宏
      

  3.   

    DECLARE_DYNAMIC(CRightView)IMPLEMENT_DYNAMIC(CRightView, CPropertyView )