function overloading and function pointers (this piece is important, follow up to continue learning):
When you assign a value to a function pointer using the overloaded functions name
Selecting candidates that are consistent with the parameter list of a function pointer based on overloaded rules
The function types that match the candidate's function type and function pointer strictly
#include <iostream>using namespace std;void myfunc (int a) { printf ("a:%d\n", a);} Void myfunc (char *p) { printf ("p:%s\n", p);} Void myfunc (int a,int b) { printf ("a:%d\n", a);} function pointers Underlying syntax//1 declares a function type//void myfunc (int a,int b) typedef void (Mytypefunc) (int a,int b);//mytypefunc *myfuncp = null;//defines a pointer to a function that points to the entry address of the function//2 Declares a function pointer type typedef void (*MYPTYPEFUNC) (int a,int b);//Declares a pointer function type//MYPTYPEFUNC&NBSP;FP = null; //defines a function pointer by using the function pointer type defined//3 a function pointer variable void (myvarpfunc) ( INT&NBSP;A,INT&NBSP;B); Int main (int argc, char *argv[]) { Myptypefunc fp = null; fp = myfunc (); FP (; cout << ) "hello world!"&NBSP;<<&NBSP;ENDL;&NBSP;&NBSP;&NBSP;&NBSP;RETURN&NBSP;0;}
Note Distinguishing function overloading overrides redefinition
This article is from the "11907685" blog, please be sure to keep this source http://11917685.blog.51cto.com/11907685/1893303
function overloading (cont.) = = "function overloading with function pointers