Examveda

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

C. To add properties to classes

D. To define methods for instance attributes

Answer: Option B

Solution (By Examveda Team)

The @property decorator is used to define a getter method for a class attribute, allowing access as a property.

This Question Belongs to Python Program >> Advanced OOP Concepts

Join The Discussion

Related Questions on Advanced OOP Concepts

What is inheritance in OOP?

A. Creating new objects from existing ones

B. Allowing objects to share attributes and methods

C. Restricting access to object attributes

D. Converting classes into objects