题解 | #重载运算#
重载运算
https://www.nowcoder.com/practice/342d1b8b0fe3416797bad62d22cbb51a
class Coordinate:
def __init__(self, x, y):
self.x = x
self.y = y
def __add__(self, other):
return Coordinate(self.x + other.x, self.y + other.y)
xy_1 = input()
xy_2 = input()
x_1, y_1 = map(int, xy_1.split())
x_2, y_2 = map(int, xy_2.split())
c1 = Coordinate(x_1, y_1)
c2 = Coordinate(x_2, y_2)
c = c1 + c2
print(f"({c.x}, {c.y})")