OOP

1 min read

Abstraction

boxes inside boxes

Encapsulation

Hide data and selectively reveal

Inheritance

Create parent child relationships

Creates an β€œis-a” relationship.

For example if Mars inherits from a Planet, Mars is a planet

Polymorphism

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