get function member address
问题 Is there any way to get the exact address of a function member? For example I have : struct foo { void print() { printf("bla bla bla"); } }; ////////////////////////////////////////////////////////////// unsigned int address = foo::print; 回答1: You can use the following syntax to declare the pointer to the member function: typedef void (foo::*address)(); address func = &foo::print; In order to call non-static member function you will need an existing instance of that class: (fooInstance.*func)