#include class A { public: A() : w(1), v(2) { q = 80; ch1 = 'U'; ch2 = 'V'; ch3 = 'a';} ~A() {} void foo() { std::cout << "A::foo " << this << " " << w << std::endl; } void quux() {}; void quuux(int a) { std::cout << "A::quuux " << this << " " << w << " " << a << std::endl; } private: int w, v; char ch1, ch2, ch3; double q; }; int main(int argc, char **argv) { A *a = new A(); // private members are inaccessible outside the class... // std::cout << a->w << " " << a->v << std::endl; // ...but they're still there if you know where to look // beginning of an instance of A looks the same an array of two ints std::cout << ((int *)a)[0] << " " << ((int *)a)[1] << std::endl; // for other fields we do the pointer arithmetic in bytes an coerce the // compiler into reading the right type from the resulting address std::cout << *((double *)((char *)a + 16)) << std::endl; delete a; } /* (gdb) x/6x a 0x613e70: 0x00000001 0x00000002 0x00615655 0x00000000 0x613e80: 0x00000000 0x40540000 */