I am having some trouble with passing a function that is a member of the class 'F' to a function that is the member of class 'X'.I get the error 'error: no match function for call to X::call()' Sorry if the solution is really simple, I'm still fairly new to C++
My code:
#include <iostream>
using namespace std;
class X{
public:
void call (void (*func)()){
func();
}
};
class F{
public:
void Function(){
cout<<"hello";
}
};
int main()
{
X x;
F f;
x.call(f.Function);
return 0;
}
basically I'm just trying to pass the function from class F into class X call function.
Thanks in advance for your help.