Vidyalelo
Python · Q16

Advanced OOP Concepts

Programming · Python · question 16

Q16

What is the purpose of the @property decorator in advanced OOP?

A.
To define a setter method for a class attribute
B.
To define a getter method for a class attribute
Answer
C.
To add properties to classes
D.
To define methods for instance attributes

Answer: Option B

Solution

Answer: Option B
Solution:
The @property decorator is used to define a getter method for a class attribute, allowing access as a property.