A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.w3schools.com/python/ref_func_super.asp below:

Website Navigation


Python super() Function

Python super() Function

❮ Built-in Functions

Example

Create a class that will inherit all the methods and properties from another class:

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, and welcome!")

x.printmessage()


Try it Yourself » Definition and Usage

The super() function is used to give access to methods and properties of a parent or sibling class.

The super() function returns an object that represents the parent class.

Syntax Parameter Values

No parameters

❮ Built-in Functions

Track your progress - it's free!


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4