super() Function
Introduction to OOP's
Class
Object
Constructor
Instance Variables
Class Variables
Instance Methods
self Keyword
Encapsulation
Public Members
Protected Members
Private Members
Inheritance
Single Inheritance
Multiple Inheritance
Multilevel Inheritance
Hierarchical Inheritance
Hybrid Inheritance
super() Function
Polymorphism
Method Overriding
Duck Typing
Abstraction
Abstract Class
Abstract Method
Class Method
Static Method
Special Methods
_str_ Method
Operator Overloading
Composition
Aggregation
Association
Method Resolution Order
Object Class
issubclass() and isinstance()
Property Decorator
Setter Method with @property
Destructor
Inner Class
Complete Mini Example
super() Function
18. super() Function
The super() function is used to call methods from a parent class. It is commonly used inside constructors and overridden methods in child classes.
Syntax
super().__init__()
super().method_name()
Example
class Person:
def __init__(self, name):
self.name = name
class Student(Person):
def __init__(self, name, roll):
super().__init__(name)
self.roll = roll
s = Student("Kiran", 101)
print(s.name)
print(s.roll)
Output
Kiran
101
Example
Executing...
❌ Error:
✅ Output:
// Click Run ▶ to execute
🏋️ Test Yourself With Exercises
Take our quiz on super() Function to test your knowledge.
Browse Quizzes »