Advertisement
Josif_tepe

Untitled

Mar 22nd, 2021
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.49 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. #include <stack>
  4. #include <fstream>
  5. #include <algorithm>
  6.  
  7. using namespace std;
  8.  
  9. class Point {
  10. private:
  11.     int x;
  12.     mutable int y;
  13. public:
  14.     Point(int _x = 0, int _y = 0) {
  15.         x = _x;
  16.         y = _y;
  17.     }
  18.    
  19.     int get_x() const {
  20.         return x;
  21.     }
  22.     int get_y() const {
  23.         y++;
  24.         return y;
  25.     }
  26. };
  27. int main()
  28. {
  29.     const Point p(10, 10);
  30.     cout << p.get_y() << endl;
  31.      
  32.     return 0;
  33. }
  34.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement