CompuServe Messages

ptrs to member functions

    05-Mar-90 16:14:40
Fm: John M. Dlugosz 74066,3717
To: Chuck Leamon 71551,16
<<function needs a member function's address>> The address of a member function is taken with a member pointer. See January's CLM for a good coverage of the topic. Notice thatinsead of a * in the pointer definition, the member-qualified pointer is used instead. That is about all there is to it. class needs_function { public: needs_function ( int (has_function::*func)(void*)); }; Zortech you say? They don't support member pointers, sorry. You will have to trick it. Here is a portable, and not tricky, way: int point_to_a (has_function& THIS, other_params) { return THIS.a (other_params); } Make a non-member shell function around each member function. Take the address of the shell function instead. –John