Q. What will be the output of the following Python code?
Code:
class A: def __init__(self): self.__x = 1 class B(A): def display(self): print(self.__x) def main(): obj = B() obj.display() main()
β
Correct Answer: (B)
Error, private class member can’t be accessed in a subclass