Assign the public object member address to a pointer
#include <iostream> using namespace std; class MyClass { public: int i; MyClass(int j) { i = j; } }; int main() { MyClass myObject(1); int *p; p = &myObject.i; cout << *p; return 0; }