AFX_PMSG数据结构
定义: typedef void (AFX_MSG_CALL CCmdTarget::*AFX_PMSG)(void);
void (AFX_MSG_CALL CCmdTarget::*AFX_PMSG)(void); //AFX_MSG_CALL定义为空,只为强调是MSG_CALL
void (CCmdTarget::*AFX_PMSG)(void); //指定(限定)为ccmdTarget 的成员函数
typedef void (*AFX_PMSG)(void); //使用typedef定义函数指针类型: AFX_PMSG
void (*afx_pmsg)(void); //普通函数指针
//===========
typedef void (AFX_MSG_CALL CCmdTarget::*AFX_PMSG)(void);
AFX_PMSG pfunc; //用AFX_PMSG定义变量pfunc,则:
加上CCmdTarget::限定,则:(有无此限定导致了函数的调用约定不同,全局函数和类方法的约定是不同的)
1.定义的函数指针变量只能用该类的类方法赋值
2.只能在类内部使用
3.唯一的使用形式(this->*pfunc)();
同时,类名限定不会影响该类型的作用域,即:
1.类外部定义,为全局作用域(类外部或者内部,可直接定义变量,好比一般的自定义全局类型如struct)
2.类内部定义,作用域为类内部(外部仍可通过作用域解析符使用)