fork(10) 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. virtual void Report() { cout << "Third" << endl; }
  22. };
  23.  
  24. int main()
  25. {
  26. Third third;
  27. return 0;
  28. }
Success #stdin #stdout 0s 3468KB
stdin
Standard input is empty
stdout
Second