Python Programming - Inheritance - Discussion

Discussion Forum : Inheritance - General Questions (Q.No. 103)
103.
In Python, what is the purpose of the @property decorator?
To create a new instance of the class
To define a method that can be accessed like an attribute
To access class attributes directly
To define a method that can be accessed as a read-only attribute
Answer: Option
Explanation:
The @property decorator is used to define a method that can be accessed as a read-only attribute, providing a getter method.
Discussion:
Be the first person to comment on this question !

Post your comments here:

Your comments will be displayed after verification.