Question OOP-POLY-0035
EasyWhat is the output of this code?
class V:
def __init__(self, x):
self.x = x
def __add__(self, other):
return V(self.x + other.x)
print((V(2) + V(3)).x)
- A.
Error
- B.
6
- C.
Sign up free to see the answer and a step-by-step explanation.