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