2026-08-20
point.cpp
struct Point {
int x;
int y;
// write operator== here
};
Implement operator== so two Points compare equal when their x and y are both equal.
Reference
bool operator==(const Point& a, const Point& b) {
return a.x == b.x && a.y == b.y;
}
Written here as a free function; a member bool operator==(const Point& other) const comparing x == other.x && y == other.y works just as well.