I am just wondering what these operators do? I can't find the answer on google :<
I know they are member access operators, but I can't understand what they do.
int *p; a pointer to integer int Testpm::*pmd; a pointer to integer that it is a member of `Testpm' class int (Foo :: * ptr); superfluous parenthesis.
while we are at it void (*foo)(int n); a function pointer, to functions that return nothing and receive an integer parameter void (Foo::*foo) (int n);a member function pointer, to member functions of class `Foo' that return nothing and receive an integer parameter void (*foo)(Foo *this, int n); "equivalent" C form (conceptual)
1 2 3 4 5 6 7 8 9 10
class Foo{
public:
void bar(int n);
};
int main(){
Foo asdf;
void (Foo::*ptr)(int n) = &Foo::bar;
(asdf.*ptr)(42); //note the parenthesis, because of precedence rules
}