I have the following code in my Individual.hpp file:
typedef string (Individual::*getMethodName)(void);
static getMethodName currentFitnessMethodName;
static string getCurrentFitnessMethodName();
And this on my .cpp file:
string Individual::getCurrentFitnessMethodName(){
return (Individual::*currentFitnessMethodName)();
}
I'm using function pointers in other parts of my code but always in the same object context, so I do (this->*thingyMajigger)(params), but with that static call I get the following error:
Expected unqualified-id
I have tried multiple permutations of said code but none seem to work. Can anyone share some light?
Cheers
currentFitnessMethodNamerequires anIndividualobject to be called on. In your static functiongetCurrentFitnessMethodName, there is nothispointer. Do you have anotherIndividualobject you can use there?