Python Programming - Classes - Discussion

Discussion Forum : Classes - General Questions (Q.No. 11)
11.
What is the purpose of the @property decorator?
It defines a property of a class that can be accessed using dot notation.
It marks a method as a getter for a class attribute.
It is used to create an instance variable in a class.
It indicates a method that can only be accessed by the class itself.
Answer: Option
Explanation:
The @property decorator is used to define a getter method for a class attribute. It allows the method to be accessed like an attribute without using parentheses.
Discussion:
Be the first person to comment on this question !

Post your comments here:

Your comments will be displayed after verification.