关于VC中函数数组指针的有关问题!error C2064: term does not evaluate to a function
关于VC中函数数组指针的问题!error C2064: term does not evaluate to a function
函数数组中的指针指向我的类中定义的函数。
方法如下:
头文件中的定义:
class CMyClassDlg : public CDialog
{
........
typedef void (CMyClassDlg ::* PFUNCTION)(); //类型
PFUNCTION pFuncArray[5][7]; //这个是函数指针数组
.......
protected:
afx_msg void On0103(); //需要被指向的函数
}
//.cpp函数中的使用
//下面是初始化:
BOOL CMyClassDlg ::OnInitDialog()
{
pFuncArray[0][0] = &CMyClassDlg::On0103; //这里敷值,编译通过
}
//下面是调用,此处出错
void CMyClassDlg ::Application()
{
*(pFuncArray[0][0])();
//这里编译出错,不管怎么改都提示
//error C2064: term does not evaluate to a function
------解决方案--------------------
(this-> *(pFuncArray[0][0]))();
嘿嘿!
函数数组中的指针指向我的类中定义的函数。
方法如下:
头文件中的定义:
class CMyClassDlg : public CDialog
{
........
typedef void (CMyClassDlg ::* PFUNCTION)(); //类型
PFUNCTION pFuncArray[5][7]; //这个是函数指针数组
.......
protected:
afx_msg void On0103(); //需要被指向的函数
}
//.cpp函数中的使用
//下面是初始化:
BOOL CMyClassDlg ::OnInitDialog()
{
pFuncArray[0][0] = &CMyClassDlg::On0103; //这里敷值,编译通过
}
//下面是调用,此处出错
void CMyClassDlg ::Application()
{
*(pFuncArray[0][0])();
//这里编译出错,不管怎么改都提示
//error C2064: term does not evaluate to a function
------解决方案--------------------
(this-> *(pFuncArray[0][0]))();
嘿嘿!