pointer to member function
Posted on 1998-10-21
I am trying to create a function pointer in my class
that will point to different member function within the
My problem is that I cant figure out how to call the
Here is a very simple example:
typedef void (CDevice::* EraseFnPtr)(int i);
void Erase1(int i);
void Erase2(int i);
Erase = &CDevice::Erase1;
void CDevice::Erase1(int i)
I want the program to print out "Erase1 34".
But I get 2 compile errors that say
error C2065: 'Erase' : undeclared identifier
error C2297: '.*' : bad right operand
both regarding to this line:
This is in Visual C++ 5.0
So How do I call the Erase function pointer?
PS I dont want to change the way the class is set up, In other words I want the function pointer to be within the CDevice class.