fork(1) download
  1. #include <iostream>
  2. #include <iomanip>
  3.  
  4. using namespace std;
  5.  
  6. struct A { int a; };
  7. struct B { int b; };
  8. struct C { int c; };
  9.  
  10. struct ABC
  11. : public A
  12. , public B
  13. , public C
  14. {
  15. int abc;
  16. };
  17.  
  18. int main()
  19. {
  20. ABC* abc = new ABC;
  21. cout << "abc: " << abc << endl;
  22. A* a = static_cast<A*>(abc);
  23. cout << "a: " << a << endl;
  24. B* b = static_cast<B*>(abc);
  25. cout << "b: " << b << endl;
  26. C* c = static_cast<C*>(abc);
  27. cout << "c: " << c << endl;
  28. }
Success #stdin #stdout 0s 15232KB
stdin
Standard input is empty
stdout
abc: 0x56242a01ac20
a: 0x56242a01ac20
b: 0x56242a01ac24
c: 0x56242a01ac28