Question OOP-INH-0045
MediumWhat is the output of this code?
class Base:
def __init__(self):
self.x = 1
class Child(Base):
def __init__(self):
self.y = 2
c = Child()
print(hasattr(c, "x"), hasattr(c, "y"))
- A.
True True
- B.
False True
- C.
Sign up free to see the answer and a step-by-step explanation.