fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. class Player
  5. {
  6. private:
  7. int score;
  8. public:
  9. Player(int number) : score(number) { }
  10. ~Player() { }
  11. int get_score() { return score; }
  12. Player& operator--(int x) { score--; }
  13. };
  14.  
  15. class Computer : public Player {
  16. public:
  17. Computer() : Player(5) { }
  18. };
  19.  
  20. class Human : public Player {
  21. public:
  22. Human() : Player(420) { }
  23. };
  24.  
  25. int main() {
  26. Computer comp;
  27. Human player;
  28. player--;
  29. comp--;
  30. }
Success #stdin #stdout 0s 15232KB
stdin
Standard input is empty
stdout
Standard output is empty