Hello,
Let's take for example the following code:
class X { public: int i; void MFunc() { } };
// Declare an instance of X: X x; // To declare a pointer to field i within class // X, I could use the pointer to member syntax: int X::*imptr = &X::i; // However, I could also bind the pointer directly // to an instance of the class, x: int* iptr = &x.i; // In terms of accessing i within an instance of X, // the two semantics achieved the same effect; // iptr and &(x.*imptr) point to the same address // So now, what about pointers to member functions // I could again use the member function syntax, as // in the previous example: void (X::*MFunc)() = &X::MFunc; // But why can't I bind a regular function pointer // directly to x, an instance of X, like I did before void (*fptr)() = &x.MFunc; // error C2276
error C2276:'&': illegal operation on bound member function expression
Thanks in Advance
Max Kukartsev