1 min read
boxes inside boxes
Hide data and selectively reveal
Create parent child relationships
Creates an “is-a” relationship.
For example if Mars inherits from a Planet, Mars is a planet
Means many shapes, makes it easy to adapt
Many different classes could have a method with the same name but with a different implementation. With polymorphism, every class will execute its correct method.
Polymorphism could be static or dynamic Method overloading is used for static polymorphism. Inheritance + method overriding is used for dynamic polymorphism.
February 26, 2020