Advance Python - Inheritance

avatar

NaN years ago

You may have heard the term inheritance in stories of monarchy in which a prince possess some properties like wealth, status and biological characteristic of king and queen. These properties played important role in selecting a prince as the new king in less time.


In programming, this concept is used with intention of saving time by using methods of another class in one class. It is also one of the powerful features of object-oriented programming.


Pros of inheritance in Python

  • Inheritance saves time in coding on big projects.
  • Inheritance reduces the code size of programs.
  • Inheritance makes it easier to reuse and debug code.

Cons of inheritance in Python

  • Inheritance may lead to the wrong solution if improperly used.
  • Inheritance decease execution speed because it is dependent on another class.
  • A change in the parent class will affect the class and increase coupling between classes.


Inheritance is a widely used concept, especially in libraries to access sublibraries. you can learn to implement inheritance with Python using free resources. Click on the resources button to get amazing resources.

approvedApproved by experts
Advance Topics

Neuton's Mission

We are a team of young and enthusiastic people who are passionate about education and want to help students to learn the skills they need to succeed in life. If you want to support us, please join our community.

phonephonephonephonemail