fork(1) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. struct Base
  5. {
  6. Base(int a){ std::cout<<"Base: "<<a<<std::endl;}
  7. };
  8.  
  9. struct Der:virtual Base
  10. {
  11. Der(int):Base(0){}
  12. };
  13.  
  14. struct Derived:Der, virtual Base
  15. {
  16. Derived(int):Der(0),Base(1){}
  17. };
  18.  
  19. int main() {
  20. // your code goes here
  21. Derived(1);
  22. return 0;
  23. }
Success #stdin #stdout 0s 3296KB
stdin
Standard input is empty
stdout
Base: 1