What are the four pillars of OOPS?



Encapsulation: It can also be said data binding. Encapsulation is all about binding the data variables and functions together in class.


Polymorphism: It is a feature, which lets us create functions with same name but different arguments, which will perform differently. That is function with same name, functioning in different way. Or, it also allows us to redefine a function to provide its new definition.


Abstraction: Abstraction refers to showing only the essential features of the application and hiding the details. In C++/Java, classes provide methods to the outside world to access & use the data variables, but the variables are hidden from direct access. This can be done access specifiers. For example, phone call, we don’t know the internal processing.

Abstraction = Encapsulation + Data Hiding


Inheritance: Inheritance is a way to reuse code. The class which is inherited from, is called the base class, and the class which inherits the code from the base class is called a derived class. A derived class can use all the functions which are defined in the base class, making the code reusable.