Python Programming - Encapsulation - Discussion

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