fork(2) download
  1. struct A {};
  2. struct D { virtual void f()=0; /* g, e, ...*/ };
  3. struct B: public A,D { void f(){}; /* g, e, ...*/ };
  4. struct C: public A,D { void f(){};/* g, e, ...*/ };
  5.  
  6. template <typename T>
  7. A* prepare(T* t)
  8. {
  9. t->f();
  10. // g()
  11. // e()
  12. return t;
  13. }
  14.  
  15. int main()
  16. {
  17. bool isC = true;
  18. A *a = isC ? prepare(new B()) : prepare(new C());
  19. }
  20.  
Success #stdin #stdout 0s 3408KB
stdin
Standard input is empty
stdout
Standard output is empty