Advertisement
Neveles

Point.h

Nov 7th, 2019
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. #pragma once
  2. #include <cmath>
  3. #include <iostream>
  4.  
  5. using namespace std;
  6.  
  7. class Point
  8. {
  9. private:
  10. int x_;
  11. int y_;
  12. public:
  13. void setXY(int x, int y) { x_ = x; y_ = y; }
  14. void setX(int x) { x_ = x; }
  15. void setY(int y) { y_ = y; }
  16. void show(int x, int y) { cout << getX(); cout << " " << getY(); }
  17. int getX() const { return x_; }
  18. int getY() const { return y_; }
  19. friend double getDistance(int x1, int y1, int x2, int y2); // (Point a, Point b)
  20. bool isEqual(int x1, int y1, int x2, int y2)
  21. {
  22. if (x1 == x2 && y1 == y2)
  23. return true;
  24. return false;
  25. }
  26. Point() { x_ = 0; y_ = 0; };
  27. Point(int x, int y) { x_ = x; y_ = y; };
  28. Point(const Point &ob) { x_ = ob.x_; y_ = ob.y_; };
  29. ~Point() { cout << endl << "Destructed" << endl; };
  30. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement