Archived

This topic is now archived and is closed to further replies.

Rob Loach

Pointer to a Function?

Recommended Posts

Is it possible to pass a name/pointer of a function through a method so that the method can call the function? Example:
int *foo()
{
    return 5;
}

int fooMethod(int *function())
{
    // Call the function passed through
    function();
    return 0;
}

int main()
{
    // Call the foo method passing through the foo function.
    fooMethod( foo() );
    return 0;
}
   
..... Is it possible to do that some how? I know this example seems a bit usless, but what I'm using it for would just make the program kick ass. [edited by - Rob Loach on November 17, 2003 10:06:18 PM]

Share this post


Link to post
Share on other sites