fork download
  1. #include <iostream>
  2. #include <assert.h>
  3.  
  4. using namespace std;
  5.  
  6. struct A {
  7. A() { assert(false); }
  8. A(int a) { cout << "A=" << a << endl; }
  9. };
  10. struct B : virtual A {
  11. B(int a) {}
  12. };
  13. struct C : virtual A {
  14. C(int a) : A(a) {}
  15. };
  16.  
  17. struct Hoge : B, C {
  18. Hoge() : B(1), C(2), A(3) {}
  19. };
  20.  
  21. int main(int ac, char* av[]) {
  22. Hoge hoge;
  23. return 0;
  24. }
  25.  
Success #stdin #stdout 0.01s 2724KB
stdin
Standard input is empty
stdout
A=3