Point.cpp 526 B

123456789101112131415161718192021222324252627282930313233343536
  1. #include "Point.h"
  2. #include <fstream>
  3. //METHODS
  4. //constructor
  5. Point::Point(double x, double y)
  6. {
  7. m_x = x;
  8. m_y = y;
  9. }
  10. bool Point::operator==(const Point& other) const
  11. {
  12. if (m_x == other.m_x && m_y == other.m_y)
  13. {
  14. return true;
  15. }
  16. return false;
  17. }
  18. std::ostream& operator<<(std::ostream& os, const Point& point)
  19. {
  20. os << " x= " << point.m_x << " y= " << point.m_y;
  21. return os;
  22. }
  23. Point& operator>>(std::ifstream& is, Point& point)
  24. {
  25. char buff[20];
  26. is>> buff >> point.m_x;
  27. is >> buff >> point.m_y;
  28. return point;
  29. }