fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. class First
  5. {
  6. public:
  7. virtual void Report() { cout << "First" << endl; }
  8. };
  9.  
  10. class Second : public First
  11. {
  12. public:
  13. virtual void Report() { cout << "Second" << endl; }
  14. Second() {}
  15. };
  16.  
  17. class Third : public Second
  18. {
  19. public:
  20. Third() : Second() { Report(); }
  21. virtual void Report() { cout << "Third" << endl; }
  22. };
  23.  
  24. int main()
  25. {
  26. Third third;
  27. return 0;
  28. }
Success #stdin #stdout 0s 5320KB
stdin
Standard input is empty
stdout
Third