fork download
  1. #include <iostream>
  2.  
  3. class Foo
  4. {
  5. int i;
  6.  
  7. public:
  8. Foo(int i) : i(i) {}
  9. };
  10.  
  11. int main()
  12. {
  13. Foo f(5);
  14.  
  15. int i = *reinterpret_cast<int*>(&f);
  16.  
  17. std::cout << i << std::endl;
  18. return 0x0;
  19. }
Success #stdin #stdout 0s 3344KB
stdin
Standard input is empty
stdout
5