What are 4 Pillars of OOPS?

Hello Friends,

Today, we will go through the 4 pillars of OOPS (Object Oriented Programming concepts).

These are the fundamental building blocks in software life cycle and the basic question every interviewer expects you to be aware of these concepts.

The easiest way to remember these four is to remember A PIE (SLICE) in PIZZA. The acronym “A PIE” can help you recall the four pillars of object-oriented programming.

A – ABSTRACTION : From object oriented point of view  SHOW only what is required and HIDE un-necessary information.  In simple terminology, It is hiding the un-necessary details from the user. For Example: When you switch on AC / Fan, you will get cool breeze, how the electrical energy is converted to mechanical energy to make it work is hidden from the user.

P – POLYMORPHISM : There are 2 words you need to understand here, POLY means many and MORPH means forms.  In object oriented programming world it deals with the ability of a function / method to make different forms. For Example: Visualize a person behaving differently depending on the situation, when at work and when at home. In software programming this is achieved using method overload and method override.

I – INHERITANCE : This is the easiest concept to understand, In real world we inherit some features from our parents. From programming point of view, it is the ability to base class properties and the child classes have their functionality. like the way we inherit assets and earning our own assets.

E – ENCAPSULATION : Encapsulation means data bundling allowing the data and members to be protected and exposing the public access methods using getters and setters along with the methods that operate on that data, into a single unit. It is used to hide both members and functions or methods associated with an instantiated class or object. This can be achieved using access modifiers.

To the best of my knowledge I documented here, please provide your feedback in the comments section, If you see something is not correct in this post.

4solidprinciples

Please leave any feedback in the comments area. Happy Learning 🙂

Comments are not allowed for the posts older than 30 days.

Please Click Here to contact me if you have any questions.