Pointers to member functions - quick Q
Hi,
I know they're not used often and there are usually better options, but I thought I'd learn about them for the sake of completeness. I have a question about them.
I always thought that the name of a function is a pointer to that function, much like the name of an array is a pointer to the first element of the array. Is this not the case for member functions? For example, something like this won't compile
Code:
int (MyClass::*pFunc)() const = 0;
pFunc = MyClass::getMemberVariable;
But this will
Code:
int (MyClass::*pFunc)() const = 0;
pFunc = &MyClass::getMemberVariable; //need the "address of" operator here to make it work
Answers much appreciated
Thanks for your time :)
Stonehambey