Inheritance is a fundamental concept in object
Inheritance is a fundamental concept in object
allows a class (child or subclass) to inherit properties and behaviors (methods) from
another class (parent or superclass). It promotes code reusability and hierarchical
relationships.
Types of Inheritance
Example in Python
# Parent class
class Animal:
def speak(self):
class Dog(Animal):
def bark(self):
print("Dog barks")
d = Dog()