class MathOperations:
def __init__(self, x, y):
self.x = x
self.y = y
def __add__(self, other):
print("Performing addition..."
return self.x + other.y
def __sub__(self, other):
print("Performing subtraction..."
return self.x - other.y
def __mul__(self, other):
print("Performing multiplication..."
return self.x * other.y
def __truediv__(self, other):
print("Performing division..."
return self.x / other.y
# Example usage
op1 = MathOperations(5, 10)
op2 = MathOperations(7, 3)
result1 = op1 + op2
print(result1) # Output: "Performing addition... 15"
result2 = op1 - op2
print(result2) # Output: "Performing subtraction... 2"
result3 = op1 * op2
print(result3) # Output: "Performing multiplication... 30"
result4 = op1 / op2
print(result4) # Output: "Performing division