Darken wrote:
The class function sum is expecting as first argument a pointer to a global function, not a pointer to a class function.
Here is the version of sum() which receives a pointer to a test class function :
class test
{
public:
double sum( double ([color=FF9900]test::[/color]*g)(int m),int n);
};
Yep!
The thing to remember about function definitions (and hence pointers to functions) is that all non-static class member functions have an invisible argument (the classes' 'this' pointer).
What this means is that
test::sum(double (*g)(int m), int n)
is different from
sum(double (g*)(int m), int n)
and as such have different pointer types.
On the topic of pointers to functions, I'd reccomend that you use a few typedefs to hide the nasty syntax.