Hey everyone, learning object-oriented programming is very important, and more than that it is important to have clarity on the topics it covers.
So here we discuss 2 ⚁, important ones.
Firstly,
let's talk about
INHERITANCE -
Parent Class: Cat
Child Class: The class which will inherit the methods and data fields of the parent class, while having its fields or methods.
Advantages :
1) Reusability: You Don't have to write already existing lines of code.
POLYMORPHISM -
Poly means many and morphism means forms.
In short -
The ability to write something in more than one form.
Two types: Static and Dynamic
Static - Different signature in the same derived class.
Dynamic - Same signature, 1 method in the base class, other in the child class
Example - Shapes Class and Types of Shapes are circle, square, and triangle.
Advantage - Flexibility
I hope you've enjoyed this Post on Object-Oriented Programming.
Top comments (0)