Python Programming - Inheritance - Discussion

Discussion Forum : Inheritance - General Questions (Q.No. 78)
78.
What is the purpose of the @staticmethod decorator?
To create a new instance of the class
To define a method that can be accessed like an attribute
To access class attributes directly
To define a method that does not access instance-specific attributes
Answer: Option
Explanation:
The @staticmethod decorator is used to define a method that does not access instance-specific attributes, making it independent of instance state.
Discussion:
Be the first person to comment on this question !

Post your comments here:

Your comments will be displayed after verification.