Both of these operators are used to dereference a pointer to an element. Unlike regular pointers, member pointers cannot be dereferenced by themselves, but must be applied to the actual type object. These binary operators select an object (or pointer) on the left side and apply a pointer to a member to it.
struct test { int a, b, c; }; int main() { int test::*ptr; ptr = &test::a; test t; t.*ptr = 5;
source share