Table of contents
No headings in the article.
In Last part we already had a discussion about why OOP -Approach is useful & in this part we'll discuss about pillars of Object Oriented.
There are four Pillars.
1.Abstraction
2.Inheritance
3.Polymorphism
4. Encapsulation
Brief Introduction of every pillar is given below:
- Abstraction
It is used for taking all irrelevant data out of your sight(detail hiding).
Example: Assume you are a seller on a website, than interface and functionalities are different for you as compared to those who are buying stuff from that same site.
- Inheritance
Inheritance is exerted to increase reusability of code and create links between classes.
Example: Inheritance could be understood by considering a parent with light-blue eyes and than this blue-eyed trait is inherited to there off-springs as well is known as inheritance mean while in programming(parent is called parent class and off-spring is named as derived class).
- Polymorphism
Polymorphism means doing same thing in different ways.
Example: notifications on mobile phones, email from companies these both are source of messages ,right so notifications and emails are imposing same purpose with different approach.
- Encapsulation
Encapsulation means data hiding and making it more simpler and easy to use like a capsule, Encapsulation will enclose your code into coat .
Example: Best way to get concept of encapsulation is to visualize a capsule how wrapper encloses inner material from outer world, exact situation is with encapsulation concept wrapper could be class or function or any other member variable etc and inner material is code.
In next part we'll look into these concepts with further more detail.