Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Method super() | Inheritance
Object-Oriented Programming in Python
course content

Course Content

Object-Oriented Programming in Python

Object-Oriented Programming in Python

Method super()

To call the parent's class method instead of the current one, we use the_super()_method in Python.

Code

We create the Cat object. The super() method inside the Cat object refers to the parent's class Animal. So Animal constructor is called first.

Afterward, go back to the Cat constructor, initialize the age attribute and print the message.

The last output is:

Select the correct answer

Everything was clear?

Section 3. Chapter 3
We're sorry to hear that something went wrong. What happened?
some-alt