fork download
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. struct A {};
  6. struct B : A {};
  7. struct C : A {};
  8. struct D : B, C {};
  9.  
  10. int main() {
  11.  
  12. D * d = new D;
  13.  
  14. B * b = d;
  15. C * c = d;
  16.  
  17. A * a1 = b;
  18. A * a2 = c;
  19.  
  20. cout << boolalpha << (a1 == a2) << endl;
  21. }
  22.  
Success #stdin #stdout 0.01s 2856KB
stdin
Standard input is empty
stdout
false