Home >>Python Built-in Functions >Python super() Function
Python super() function is used to offer access to the methods and the properties of a parent or sibling class. It returns an object that represents the parent class.
Syntax:super()Here is an example of Python super() function:
class Parent:
def __init__(self, txt):
self.message = txt
def printmessage(self):
print(self.message)
class Child(Parent):
def __init__(self, txt):
super().__init__(txt)
x = Child("Hello, welcome to PHPTPOINT!")
x.printmessage()