Python Programming - Encapsulation - Discussion
Discussion Forum : Encapsulation - General Questions (Q.No. 63)
63.
What is the advantage of encapsulating a class attribute with a double underscore prefix, such as __count?
class MyClass:
__count = 0
def increment_count(self):
MyClass.__count += 1
Answer: Option
Explanation:
Encapsulation with a double underscore prefix improves code maintainability by hiding the implementation details of the class attribute __count.
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