1 #include "stdafx.h" 2 3 #include <iostream> 4 #include <string> 5 using namespace std; 6 7 8 //自己实现委托 9 class A { 10 public: 11 void Func(int i) { printf("afff%d ",i); } 12 }; 13 14 void (A::*pFunc)(int) = &A::Func; 15 16 char (*pFun)(int) ; 17 char glFun(int a){ return 'a';} 18 19 int _tmain(int argc, _TCHAR* argv[]) 20 { 21 //A a; 22 //A* pa = &a; 23 //(pa->*pFunc)(11); 24 25 pFun = glFun; 26 (*pFun)(2); 27 return 0; 28 }