class Point:
def __init__(self, x, y):
self.x = x
self.y = y
def __add__(self, other):
return Point(self.x + other.x, self.y + other.y)
def __sub__(self, other):
return Point(self.x - other.x, self.y - other.y)
def __mul__(self, other):
return Point(self.x * other.x, self.y * other.y)
def operation_result(self):
print(f'({self.x}, {self.y})')
def my_point(a, b):
return a - b
if __name__ == '__main__':
my_point(Point(1, 2), Point(3, 4)).operation_result()
06-01
6786
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
06-16
126
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)