Question OOP-CLS-0064
HardWhat is the output of this code?
class C:
count = 0
def __new__(cls, *a):
cls.count += 1
return super().__new__(cls)
def __init__(self, v):
self.v = v
objs = [C(i) for i in range(3)]
print(C.count, objs[2].v)
- A.
3 2
- B.
1 2
- C.
Sign up free to see the answer and a step-by-step explanation.