fork(1) download
  1. #include <iostream>
  2.  
  3. struct base
  4. {
  5. void foo()
  6. {
  7. std::cout << "foo" << std::endl;
  8. }
  9. };
  10.  
  11. struct derived : base {};
  12.  
  13. struct other {};
  14.  
  15. int main()
  16. {
  17. other o;
  18.  
  19. base &bref = reinterpret_cast<base&>(o);
  20. bref.foo();
  21. }
Success #stdin #stdout 0s 4308KB
stdin
Standard input is empty
stdout
foo