I have a problem with my code and i don't know how i could solve this. So, i have a class (ex: myClass) and inside a function that should return a pointer at a void function that have myClass as a parameter. To return the pointer at the function i have to use this statement "typedef void(*fp)(const myClass &object)" before defining the class and it's methods, but since the parameter is type MyClass, the compiler tells me that the class hasn't been declared.
("fp getFunction()" requires "typedef" and "typedef" requires "myClass" to be defined. I don't know that i've made myself clear, but i will answer all the questions if they are about the code.)
EDIT: If i try to put "typedef" after myClass declaration, my compiler tells that "fp is not a type" (or something like that).
typedef void(*fp)(const myClass& object);
class myClass{
private:
char statement[100];
void (*_pointer)(const myClass& object);
public:
void setStatement(char *sequence){strcpy(statement,sequence);}
void setPointer(void (*_pointerToFunction)(const myClass& object)) {_pointer = _pointerToFunction;}
fp getFunction() {return _pointer;}
void showStatement() {cout << statement << " ";}
};