Python Programming - Encapsulation - Discussion
Discussion Forum : Encapsulation - General Questions (Q.No. 93)
93.
Consider the following Python code:
class Rectangle:
def __init__(self, __length, __width):
self.__length = __length
self.__width = __width
def calculate_area(self):
return self.__length * self.__width
What is the purpose of the calculate_area() method?
Answer: Option
Explanation:
The calculate_area() method calculates and returns the area of the rectangle, 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