I\'ve never used it before and just stumbled upon it in an article... I thought it would be the equivalent to *x->y
but apparently it isn\'t.
Here\'s
The .* and ->* operators will point to member functions of a class or structure. The code below will show a simple example of how to use the .* operator, if you change the line:
Value funcPtr = &Foo::One;
to Value funcPtr = &Foo::Two;
the result displayed will change to 1000 since that function is inValue*2
for example Taken From Here:
#include
#include
class Foo {
public:
double One( long inVal ) { return inVal*1; }
double Two( long inVal ) { return inVal*2; }
};
typedef double (Foo::*Value)(long inVal);
int main( int argc, char **argv ) {
Value funcPtr = &Foo::One;
Foo foo;
double result = (foo.*funcPtr)(500);
std::cout << result << std::endl;
system("pause");
return 0;
}