Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

C++ lol

Name: Anonymous 2011-03-29 20:53

so how does one store a pointer to a member function and the object from which to call that function, and then call said function from said object?

example:

struct test {
 /*generic function object*/ fun_ptr;
 some_object* object_instance;
} this_test;

some_object new_obj;
this_test.fun_ptr = &some_object::some_function;
this_test.object_instance = &new_obj;

this_test.object_instance->this_test.fun_ptr(/*arguments*/);

???

Name: Anonymous 2011-03-30 1:47

>>18
I'd guess he's dealing with a C callback API that only lets him specify a single pointer parameter, and is using that as a pointer to a struct passed to a stub function that calls a class member function.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List