64.6k views
0 votes
It is not possible to call a superclass's __init__ method from a subclass's __init__ method.

True
False

1 Answer

5 votes

Final answer:

In Python, you can call a superclass's __init__ method from a subclass's __init__ method using the super() function.

Step-by-step explanation:

In Python, it is false that you cannot call a superclass's __init__ method from a subclass's __init__ method. In fact, it is a common practice to do so.

When you define a subclass, you can use the super() function to call the superclass's __init__ method. This allows you to initialize the inherited attributes from the superclass before adding additional attributes to the subclass.

User Isurujay
by
7.5k points
Welcome to QAmmunity.org, where you can ask questions and receive answers from other members of our community.