Q46
What will be the output of the following Python code? class A: def __init__(self,x=3): self._x = x class B(A): def __init__(self): super().__init__(5) def display(self): print(self._x) def main(): obj = B() obj.display() main()
A.
5
AnswerB.
Error, class member x has two values
C.
3
D.
Error, protected class member can't be accessed in a subclass
Answer: Option A
Solution
Answer: Option A
No explanation is given for this question Let's Discuss on Board