Advertisement
Josif_tepe

Untitled

Nov 18th, 2023
560
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.40 KB | None | 0 0
  1. #include <iostream>
  2.  
  3.  
  4. using namespace std;
  5. class Point {
  6. private:
  7.     int x, y;
  8. public:
  9.     Point () {}
  10.     Point(int _x, int _y) {
  11.         x = _x;
  12.         y = _y;
  13.     }
  14.    
  15.     Point & operator ++ (int i) {
  16.         x++;
  17.         return *this;
  18.     }
  19.     int get_x() {
  20.         return x;
  21.     }
  22. };
  23.  
  24. int main()
  25. {
  26.     Point p(1, 2);
  27.     p++;
  28.     cout << p.get_x() << endl;
  29.     return 0;
  30. }
  31.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement