在头文件里面定义一个二维数组,想把他初始化
如:
int aa[3][4]={{1,2,3,4},{1,2},{5,4,3,2}};
在编译的时候编译系统却报错!!!
怎么回事呢?!!!
class CAaDlg : public CDialog
{
// Construction
public:
int aa[3][4]={{1,2,3,4},{1,2},{5,4,3,2}};
CAaDlg(CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(CAaDlg)
enum { IDD = IDD_AA_DIALOG };
// NOTE: the ClassWizard will add data members here
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CAaDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
HICON m_hIcon;
// Generated message map functions
//{{AFX_MSG(CAaDlg)
virtual BOOL OnInitDialog();
afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
afx_msg void OnPaint();
afx_msg HCURSOR OnQueryDragIcon();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//这是类定义
class CAaDlg : public CDialog
{
// Construction
public:
int aa[3][4];
CAaDlg(CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(CAaDlg)
enum { IDD = IDD_AA_DIALOG };
// NOTE: the ClassWizard will add data members here
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CAaDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
HICON m_hIcon;
// Generated message map functions
//{{AFX_MSG(CAaDlg)
virtual BOOL OnInitDialog();
afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
afx_msg void OnPaint();
afx_msg HCURSOR OnQueryDragIcon();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//这是构造函数
CAaDlg::CAaDlg(CWnd* pParent /*=NULL*/)
: CDialog(CAaDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CAaDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
aa[3][4]={{1,2,3,4},{1,2},{5,4,3,2}};
}