context.m_pNewViewClass = RUNTIME_CLASS(CFileSplitterView);//class CFileSplitterView : public CView{};我在CFileSplitterView类中的OnCreate( )中切割窗体了但执行了context.m_pNewViewClass = RUNTIME_CLASS(CFileSplitterView);没有调用OnCreate函数啊,构造函数也没有调用若CFileSplitterView从CFromView派生,怎么就可以执行它的构造函数

解决方案 »

  1.   

    context.m_pNewViewClass = RUNTIME_CLASS(CFileSplitterView);这一句只是返回 CFileSplitterView 的静态对象 classCFileSplitterView 的指针
    并不进行任何创建动作,当然没有调用构造函数, 更不用说OnCreate函数
      

  2.   

    RUNTIME_CLASS returns a pointer to a CRuntimeClass structure for the class specified by class_name. Only CObject-derived classes declared with DECLARE_DYNAMIC, DECLARE_DYNCREATE, or DECLARE_SERIAL will return pointers to a CRuntimeClass structure.
    不存在什么构造函数之说~~~
      

  3.   


    谢谢大家可是为什么若CFileSplitterView从CFromView 派生就可以调用的它的构造函数啊