I'm trying to write a program that has a pointer to a private member function of a class. A public member function calls some of the private functions by using this pointer. I'm using a typedef for the pointer. The typedef is:
typedef void (pvm_em::*code_ptr)(int,int);
is the name of my class. I'm making an array of these pointers as follows:
and I'm filling this array by using statements that look like:
instructions = &pvm_em::mov;
All of the code I've mentioned up to this point seems to work just fine, but I get a compiler error when I use the following line of code:
I've tried several different ways of writing this line of code (with and without the This pointer and trying to dereference the pointer), but I can't seem to get it to work. I get errors saying I must use the ".*" or "->*" operators. What are these operators, and what is the syntax for using them?
You almost got it right. Try the following: