2.8.1.5 Inheritance
Python Programming
Inheritance allows one class to inherit attributes and methods from another class. This promotes code reuse and creates a hierarchical relationship between classes.
python
class Animal:
def make_sound(self): print("Animal sound")
class Dog(Animal):
def make_sound(self):
print("Bark!")
class Cat(Animal):
def make_sound(self):
print("Meow ! ")