我用MFC自己定义了一个类,类名为 score
  类里面有个函数 rgauss
  我在一个对话框类 定义 score dlg();
  dlg.rgauss(参数) 怎么 总是无法调用这个类中的rgauss啊 ?
  自己写的函数 应该定义成什么类,我用的是 CDocument  类,感觉 有点问题
我是菜鸟 分也不多, 全给了,希望高手指教一下 

解决方案 »

  1.   

    你所谓的无法调用是什么意思?是编译不过吗?如果是编译不过的话,有可能是成员函数的类型设置了保护或私有,改成public就可以。
      

  2.   


    把你的類的聲明帖出來,
    你用CDocument類 還是派生於它?
      

  3.   

    这是我的定义的类
    class hanshu : public CDocument
    {
    protected:
    hanshu();           // protected constructor used by dynamic creation
    DECLARE_DYNCREATE(hanshu)// Attributes
    public:
    int rgauss(int n,double a[],double b[]);
    // Operations
    public:// Overrides
    // ClassWizard generated virtual function overrides
    //{{AFX_VIRTUAL(hanshu)
    public:
    virtual void Serialize(CArchive& ar);   // overridden for document i/o
    protected:
    virtual BOOL OnNewDocument();
    //}}AFX_VIRTUAL// Implementation
    public:
    virtual ~hanshu();
    #ifdef _DEBUG
    virtual void AssertValid() const;
    virtual void Dump(CDumpContext& dc) const;
    #endif // Generated message map functions
    protected:
    //{{AFX_MSG(hanshu)
    // NOTE - the ClassWizard will add and remove member functions here.
    //}}AFX_MSG
    DECLARE_MESSAGE_MAP()
    };
    为什么 我用dlg.rgauss();它总是提示 我函数没定义啊!我把类的头文件 加进去了的