fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. class Count
  5. {
  6. private:
  7. int value;
  8. public:
  9. Count(int value)
  10. {
  11. this->value = value;
  12. }
  13. Count operator ++()
  14. {
  15. ++value;
  16. }
  17. void print()
  18. {
  19. cout<< value <<endl;
  20. }
  21. };
  22. int main()
  23. {
  24. Count a(5);
  25. ++a;
  26. a.print();
  27. }
  28.  
Success #stdin #stdout 0s 5316KB
stdin
Standard input is empty
stdout
Standard output is empty