// http://stackoverflow.com/questions/670734/c-pointer-to-class-data-member class Car { public: int speed; int fuel; }; int main() { int Car::*ptr = &Car::speed; Car c1; c1.speed = 1; // direct access cout << "speed is " << c1.speed << endl; c1.*ptr = 2; // access via pointer to member cout << "speed is " << c1.speed << endl; ptr = &Car::fuel; Car c2; c2.fuel = 100; c2.speed = 20; cout << "speed is " << c2.speed << endl; // direct access cout << "speed is " << c2.*ptr << endl; // access via pointer system("pause"); int *iptr; iptr = &(c1.speed); return 0; }