C++回调成员函数
#include "stdafx.h" #include <iostream> using namespace std; class Test { public: void CallBack(char* args) { cout<<args<<endl; } }; int _tmain(int argc, _TCHAR* argv[]) { typedef (Test::*lpCallBack)(char* args); //取得函数地址 //VC8可能要改为lpCallBack func = (lpCallBack)&Test::CallBack lpCallBack func = (lpCallBack)Test::CallBack; Test t, *lpTest; lpTest = &t; (lpTest->*func)("Hello World!"); //回调测试 system("pause"); return 0; }