Advertisement
Josif_tepe

Untitled

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