fork(1) download
  1. #include <iostream>
  2. #include <ostream>
  3. #include <string>
  4. #include <utility>
  5.  
  6. using namespace std;
  7.  
  8. struct Name { string s; Name(string s) : s(move(s)) { } };
  9.  
  10. struct A : virtual Name { A(string s) : Name(move(s)) { } };
  11.  
  12. struct B : virtual Name { B(string s) : Name(move(s)) { } };
  13.  
  14. struct C : A, B { C(string s) : A(string()), B(string()), Name(move(s)) { } };
  15.  
  16. C f() { return C("abcdefghijklmnopqrstuvwxyz"); }
  17.  
  18. int main()
  19. {
  20. C c1("ABCDEFGHIJKLMNOPQRSTUVWXYZ");
  21. C c2("ABCDEFGHIJKLMNOPQRSTUVWXYZ");
  22. C ff = f();
  23. c1 = f();
  24. c2 = ff;
  25. cout << "C1 = " << c1.s << " " << "C2 = " << c2.s << "\n";
  26. return 0;
  27. }
Success #stdin #stdout 0s 3276KB
stdin
Standard input is empty
stdout
C1 = ABCDEFGHIJKLMNOPQRSTUVWXYZ C2 = abcdefghijklmnopqrstuvwxyz