Examveda

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

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


Join The Discussion

Related Questions on Concept of Object Oriented Programs in Python