i basically want to use a dif function to extract a different element of a class (ac).
the code is similar to this:
.h:
class MyClass
{
public:
double f1(AnotherClass &);
void MyClass::f0(AnotherClass & ac, double(MyClass::*f1)(AnotherClass &));
};
.cc:
double MyClass::f1(AnotherClass & ac)
{
return ac.value;
}
void MyClass::f0(AnotherClass & ac, double(MyClass::*f1)(AnotherClass &))
{
std::cout << f1(ac);
}
didn't work, it gives error#547 "nonstandard form for taking the address of a member function"
EDIT:
I call it from:
void MyClass(AnotherClass & ac)
{
return f0(ac,&f1); // original and incorrect
return f0(ac,&Myclass::f1); //solved the problem
}
However, I have another error:
std::cout << f1(ac);
^ error: expression must have (pointer-to-) function type