Python Programming - Inheritance - Discussion

Discussion Forum : Inheritance - General Questions (Q.No. 1)
1.
What is the purpose of the super() function in Python when working with inheritance?
To call the superclass constructor
To create a new instance of the subclass
To access class attributes directly
To override a method in the superclass
Answer: Option
Explanation:
The super() function is used to call the constructor of the superclass, allowing the subclass to initialize its own attributes while reusing the superclass's initialization code.
Discussion:
Be the first person to comment on this question !

Post your comments here:

Your comments will be displayed after verification.