Examveda

How does the @classmethod decorator differ from @staticmethod?

A. @classmethod can't access class attributes

B. @staticmethod can't access instance attributes

C. @classmethod can access class attributes

D. @staticmethod can access instance attributes

Answer: Option C

Solution (By Examveda Team)

The @classmethod decorator can access class attributes, while @staticmethod cannot.

This Question Belongs to Python Program >> Decorators In Depth

Join The Discussion

Related Questions on Decorators in Depth