Q. What is output of the following?
Code:
class A:
def __init__(self):
self.name = 'A'
class B(A):
def __init__(self):
super().__init__()
self.name += 'B'
b = B()
print(b.name)
β
Correct Answer: (C)
AB
Explanation: super() calls A’s __init__, then 'B' is appended to name.