Pointers to Class Members in C++

It is possible to take the address of a member of a class and assign it to a pointer. The address of a member can be obtained by applying the operator to a fully qualified class member name. A class member pointer can be declared using the operator ::* with the class name.


class test 
  int n;
 void show();
int test::* ip=&test::n;   // pointer to member declaration