Python Super() function
Understand the use of the super() method in inheritance, allowing access to the parent class's methods and properties for efficient class management - RRTutors.
Inheritance is one of the most essential OOP elements in Python. Inheritance is the process through which one class inherits one or more behaviours from another.
When one class inherits the behaviour of another, the inherited class becomes the subclass, while the original class becomes the parent class. The super() method is used to refer to the parent class in an inherited class. The super() function returns the superclass's temporary object, which gives access to all methods of its child class.
Take a look at the following example:
Example of a super() Function
class Student(object): |
Output
Name of the College: University of Hull |