fork download
  1. #include "pch.h"
  2. #include <iostream>
  3. #include <string>
  4. using namespace std;
  5.  
  6. class Animal
  7. {
  8. protected:
  9. string name;
  10. int age;
  11. public:
  12. Animal(string name_, int age_)
  13. :name(name_), age(age_)
  14. {}
  15. void Say()
  16. {
  17. cout << "???" << endl;
  18. }
  19. };
  20.  
  21. class Cat : public Animal
  22. {
  23. public:
  24. Cat(string name_, int age_, bool likeFish_)
  25. :Animal(name_, age_), likeFish(likeFish_)
  26. {}
  27.  
  28. void Say()
  29. {
  30. cout << name << " say Meow" << endl;
  31. }
  32. private:
  33. bool likeFish;
  34. };
  35.  
  36. int main()
  37. {
  38. Animal an("Qwe", 4);
  39. an.Say();
  40.  
  41. Cat barsik("Barsik", 2, true);
  42. barsik.Say();
  43. }
  44.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:1:10: fatal error: pch.h: No such file or directory
 #include "pch.h"
          ^~~~~~~
compilation terminated.
stdout
Standard output is empty