如何增加一个基类为CObject的类?有几种方法?

解决方案 »

  1.   

    运用Winzard向导就可以呀自己添加也行呀
      

  2.   

    方法有好多
    用ClassWizard的add class可以
    自己在文件中也可以
    Class CYourClass :public CObject()
    {
    ....
    }
    就可以了
      

  3.   

    我是用Wizard Add Class,但是基类中找不到CObject,于是用CDocument代替,然后将该文件中所有的CDocument改为CObject,并删除
    virtual BOOL OnNewDocument();与
    BEGIN_MESSAGE_MAP(CLine, CDocument)。
    结果编译出错,怎么回事?错在哪里?
    Line.obj : error LNK2001: unresolved external symbol "protected: virtual struct AFX_MSGMAP const * __thiscall CLine::GetMessageMap(void)const " (?GetMessageMap@CLine@@MBEPBUAFX_MSGMAP@@XZ)
    Debug/Myfile.exe : fatal error LNK1120: 1 unresolved externals
      

  4.   

    选择NewClass,GenericClass,基类填写CObject,不要理会它的提示,继续就可以了
      

  5.   

    不好意思,再问一个菜问题,楼上的你所说的newclass是不是在Message Maps中用ADD class下的newclass?可是我没有发现有Genericclass呀,自己手工填写吗?基类写不进去呀!