Inheritance
Learn how to reuse and extend functionality through inheritance.
1
Introduction to Inheritance
Inheritance is a core concept in Object-Oriented Programming (OOP) that allows a class (subclass) to inherit attributes and methods from another class (superclass). It promotes code reuse and makes code more organized.
In this lesson, you’ll learn how to implement inheritance in Python and understand its benefits.

2
Defining a Superclass
A superclass is the base class from which other classes inherit. It is defined like any other class:
# Defining a superclass
class Animal:
def speak(self):
print("Animal speaks")