注册 登录
编程论坛 VC++/MFC

关于添加成员变量?

喜鹊王子 发布于 2013-03-17 13:54, 532 次点击
// Dialog1.h : header file
class CDialog1 : public CDialog
{
// Construction
public:
    CDialog1(CWnd* pParent = NULL);   // standard constructor

// Dialog Data
    //{{AFX_DATA(CDialog1)
    enum { IDD = IDD_DIALOG1 };
    int        m_num1;
    int        m_num2;

    //}}AFX_DATA


// Overrides
    // ClassWizard generated virtual function overrides
    //{{AFX_VIRTUAL(CDialog1)
    protected:
    virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
    //}}AFX_VIRTUAL

// Implementation
protected:

    // Generated message map functions
    //{{AFX_MSG(CDialog1)
    afx_msg void OnButton1();
    //}}AFX_MSG
    DECLARE_MESSAGE_MAP()
};
——————————————————————————————————————————
************************************************************************************
// Dialog1.h : header file
class CDialog1 : public CDialog
{
// Construction
public:
    CDialog1(CWnd* pParent = NULL);   // standard constructor
    int        m_num1;
    int        m_num2;

// Dialog Data
    //{{AFX_DATA(CDialog1)
    enum { IDD = IDD_DIALOG1 };
   
    //}}AFX_DATA


// Overrides
    // ClassWizard generated virtual function overrides
    //{{AFX_VIRTUAL(CDialog1)
    protected:
    virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
    //}}AFX_VIRTUAL

// Implementation
protected:

    // Generated message map functions
    //{{AFX_MSG(CDialog1)
    afx_msg void OnButton1();
    //}}AFX_MSG
    DECLARE_MESSAGE_MAP()
};

如果我给CDialog1添加两个整形成员变量,默认的是第二种情况;如果我手动改成第一种情况,有什么区别吗?
第一种情况貌似一般是给控件添加成员变量会默认添加在这个注释宏之间。

[ 本帖最后由 喜鹊王子 于 2013-3-17 13:56 编辑 ]
1 回复
#2
yuccn2013-03-17 20:32
没有区别的
都是public
1