Python Programming - Classes - Discussion

Discussion Forum : Classes - General Questions (Q.No. 8)
8.
In Python, what is the purpose of the super() function within a subclass method?
It calls the constructor of the superclass.
It returns the superclass object.
It initializes the subclass attributes.
It creates a copy of the superclass.
Answer: Option
Explanation:
The super() function is used in a subclass to call a method or constructor from its superclass. It is commonly used within the constructor (__init__) to invoke the constructor of the parent class.
Discussion:
Be the first person to comment on this question !

Post your comments here:

Your comments will be displayed after verification.