Python Programming - Encapsulation - Discussion

Discussion Forum : Encapsulation - General Questions (Q.No. 51)
51.
In Python, what is the purpose of the @property decorator in a class?
To create a new instance of a class
To provide a getter method for a private variable
To define a private variable
To access a global variable
Answer: Option
Explanation:
The @property decorator is used in Python to create 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.