Inheritance and Polymorphism


Inheritance and polymorphism are two fundamental concepts in object-oriented programming (OOP) that are also supported in Python. They allow you to create reusable and extensible code by establishing relationships between classes.

Inheritance

Inheritance is a mechanism that allows a class (known as the child or derived class) to inherit the properties and methods of another class (known as the parent or base class). The child class can then add additional attributes or behaviors, or override the existing ones.

Here's an example:




Rs. 5.0 Rs. 10.0


Buy Now