I have a pointer to a function in a class, and am trying to cast it to (void*) to pass it to a function.
When trying to cast it to (void*) when passing it to print, gcc complains:Code:#include <stdio.h> class blah { public: int store; int something (int in); }; int blah::something (int in) { store = in; } void print (void*in) { printf ("%lx\n", in); } int (blah::*pt2Member)(int); int main () { pt2Member = &blah::something; // printf ("%lx\n", pt2Member); // print ((void*)pt2Member); print ((void*)blah::something); }
test.cpp: In function 'int main()':
test.cpp:24: error: invalid use of non-static member function 'int blah::something(int)'
Calling the printf works fine, presumably because it uses va_arg.