Python Programming - Encapsulation - Discussion
Discussion Forum : Encapsulation - General Questions (Q.No. 75)
75.
What is the primary purpose of the following Python class?
class Car:
def __init__(self, make, __model):
self.make = make
self.__model = __model
def get_model(self):
return self.__model
Answer: Option
Explanation:
The get_model() method provides controlled and read-only access to the private variable '__model', demonstrating encapsulation.
Discussion:
Be the first person to comment on this question !
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers