Python Programming - Encapsulation - Discussion
Discussion Forum : Encapsulation - General Questions (Q.No. 58)
58.
In Python, how can encapsulation be enhanced to provide write access to a private variable 'value'?
class Example:
def __init__(self):
self._value = 0
Answer: Option
Explanation:
To provide write access to a private variable, a setter method can be created to set the value.
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