Python Programming - Encapsulation - Discussion

Discussion Forum : Encapsulation - General Questions (Q.No. 43)
43.
What is the role of a setter method in encapsulation?
To retrieve the value of a private variable.
To provide a static method for a class.
To set the value of a private variable with validation.
To define a private variable.
Answer: Option
Explanation:
A setter method in encapsulation is used to set the value of a private variable with validation, ensuring controlled access.
Discussion:
Be the first person to comment on this question !

Post your comments here:

Your comments will be displayed after verification.