// TEST.cpp : main project file.
class MyClass; // forward declaration
class MyClass {
public:
MyClass(); // constructor
double MyClassMemberFunction(double); // this is the member funcion
double (MyClass::*pF)(double); // this is the pointer
};
MyClass::MyClass() {
pF = &MyClass::MyClassMemberFunction; // point to the member function..
}
usingnamespace std;
int main()
{
MyClass instance;
return 0;
}
Compiling this I get the following error from VS2010:
This leads me to think it might not be possible to have a member function pointer inside the class, because from within the declaration it's not possible to know how much space will be required for MyClass. Is this correct?