Original Post
if you just had a pointer to a function, and wanted to call it for whatever reason (callback function for a custom GUI im making in my case), how would you go about having the callback function called but with arguments passed to it.
in my case, i want a callback function for a GUI button. when the button is clicked, a function is called - but i want the function called with arguments. how could i do this?
ex:
// basic pseudo code
class GUIButton
{
// blah blah blah
func_pointer *function_to_be_called_when_button_is_clicked;
}
int x;
x = 3;
myButton = new GUIButton;
myButton.func_pointer = &some_func(x);
// not only call function that func_pointer points to, but also
// send along the argument "x".
is this possible?
- jeremiah
inlovewithGod.com