Vidyalelo
Python · Q38

Concept of Object Oriented Programs in Python

Programming · Python · question 38

Q38

What will be the output of the following Python code? class objects: def __init__(self): self.colour = None self._shape = "Circle" def display(self, s): self._shape = s obj=objects() print(obj._objects_shape)

A.
The program runs fine because name mangling has been properly implemented
B.
Error because the member shape is a protected member
Answer
C.
Error because the proper syntax for name mangling hasn't been implemented
D.
Error because the member shape is a private member

Answer: Option B

Solution

Answer: Option B
No explanation is given for this question Let's Discuss on Board