Built-in Functions
super()
Access a parent class from inside a child class.
super(type, object_or_type)
super() helps a child class reuse behaviour from its parent class.
Inside a method, the no-argument form super() is usually the easiest choice.
Parameters
| Name | Description |
|---|---|
| type | The child class, supplied automatically by zero-argument super() in a method. |
| object_or_type | An instance or class related to the child class. |
Returns
A proxy object that looks up parent class attributes.
Try it
Run it and change it
class Animal:
def speak(self): return "sound"
class Dog(Animal):
def speak(self): return super().speak() + "!"
print(Dog().speak())