fork download
  1. #include <iostream>
  2.  
  3. class top {
  4. int a;
  5. };
  6.  
  7. class left : public top {
  8. int b;
  9. };
  10.  
  11. class right : public top {
  12. int c;
  13. };
  14.  
  15. class bottom : public left, public right {
  16. int d;
  17. };
  18.  
  19. int main() {
  20.  
  21. bottom* b = new bottom ();
  22.  
  23. left* l = (left*) b;
  24. right* r = (right*) b;
  25.  
  26. std::cout << l << " " << r << '\n';
  27. return 0;
  28. }
Success #stdin #stdout 0s 3472KB
stdin
Standard input is empty
stdout
0x98ed008 0x98ed010