fork download
  1. #include <iostream>
  2.  
  3. struct A { void test() {std::cout<<"A";} };
  4. struct B { void test() {std::cout<<"B";} };
  5.  
  6. int main() {
  7. A *a = reinterpret_cast<A*>(new B);
  8. a->test();
  9.  
  10. return 0;
  11. }
Success #stdin #stdout 0s 3472KB
stdin
Standard input is empty
stdout
A