Advertisement
Josif_tepe

Untitled

Sep 12th, 2021
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.41 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4. class Point {
  5. private:
  6.     int x, y;
  7. public:
  8.     Point(int _x = 0, int _y = 0) {
  9.         x = _x;
  10.         y = _y;
  11.     }
  12.     Point(const Point &tmp) {
  13.         x = tmp.x;
  14.         y = tmp.y;
  15.     }
  16.      int get_x() const { // this means we cannot change any variable in the function
  17.        
  18.         return x;
  19.     }
  20. };
  21. int main()
  22. {
  23.    
  24.     return 0;
  25. }
  26.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement