Python Programming - Classes - Discussion

Discussion Forum : Classes - General Questions (Q.No. 17)
17.
In Python, what is the purpose of the @classmethod decorator in a subclass?
It creates a static method in the subclass.
It defines a class method specific to the subclass.
It indicates a method that takes both the class and instance as parameters.
It allows the subclass to override the method in the superclass.
Answer: Option
Explanation:
The @classmethod decorator in a subclass is used to define a class method that is specific to the subclass. It can be called on the class and is aware of the subclass.
Discussion:
Be the first person to comment on this question !

Post your comments here:

Your comments will be displayed after verification.