Python Programming - Encapsulation - Discussion

Discussion Forum : Encapsulation - General Questions (Q.No. 14)
14.
What is the role of the @property decorator in encapsulation?
To define a private variable
To create a class instance
To provide a getter method for a private variable
To access a global variable
Answer: Option
Explanation:
The @property decorator is used in encapsulation to provide a getter method for a private variable, allowing controlled access.
Discussion:
Be the first person to comment on this question !

Post your comments here:

Your comments will be displayed after verification.