The first sentence of the example was startled by the case of Uncle Mouse's study of the virtual function table (http://blog.csdn.net/haoel/article/details/1948051).
void (*fun) (void);
Thanks to the RR help, understand.
This line of code defines a function pointer type fun, function pointer, which refers to a pointer to a function
The first void refers to the function return value type, the second void is the list of function parameter types, and the general syntax:
typedef returntype (*name) (Parameter1type,parameter1type,...)
Examples are as follows:
typedefstring(*FUN1) (void); typedefvoid(*FUN2) (string,int);stringGetData () {strings; CIN>>s; returns;}voidPutData (stringSintAge ) {cout<<"My name is"<< s <<", my age is"<< Age <<Endl;}int_tmain (intARGC, _tchar*argv[]) {Fun1Get= GetData;//get is a pointer to GetData (), and the function name is the address strings =Get(); cout<< s <<Endl; Fun2 put=PutData; Put ("Lizy", -); System ("Pause"); return 0;}
Results:
"C + +" function pointer macro definition