Object Oriented Programming is not easy at first, but as you read and learn this article it will level you up. I’m going to give you some insight into the four pillars of OOP or main principles of OOP.

Four Pillars of OOP – Fundamentals of OOP

There are four pillars of oop or the main fundamentals of oop.

  • Abstraction
  • Encapsulation
  • Inheritance
  • Polymorphism

1. Abstraction

In short, data abstraction is nothing more than the implementation of an object that contains the same essential properties and actions we can find in the original object we are representing.

An abstraction denotes the essential characteristics of an object that distinguish it from all other kinds of object and thus provide crisply defined conceptual boundaries, relative to the perspective of the viewer.

Data abstraction and encapuslation are closely tied together, because a simple definition of data abstraction is the development of classes, objects, types in terms of their interfaces and functionality, instead of their implementation details. Abstraction denotes a model, a view, or some other focused representation for an actual item.

2. Encapsulation

Encapsulation is the hiding of data implementation by restricting access.

Encapsulation means that the internal representation of an object is generally hidden from view outside of the object’s definition. Typically, only the object’s own methods can directly inspect or manipulate its fields.

Hiding the internals of the object protects its integrity by preventing users from setting the internal data of the component into an invalid or inconsistent state. This type of data protection and implementation protection is called Encapsulation.

A benefit of encapsulation is that it can reduce system complexity.


3. Inheritance

Inheritance is ‘is a’ relationship between classes. This is a way to reuse code of existing objects, or to establish a subtype from an existing object, or both, depending upon programming language support. In classical inheritance where objects are defined by classes, classes can inherit attributes and behavior from pre-existing classes called base classes, superclasses, parent classes or ancestor classes. The resulting classes are known as derived classes, subclasses or child classes. The relationships of classes through inheritance gives rise to a hierarchy.

Subclasses and Superclasses A subclass is a modular, derivative class that inherits one or more properties from another class (called the superclass). The properties commonly include class data variables, properties, and methods or functions. The superclass establishes a common interface and foundational functionality, which specialized subclasses can inherit, modify, and supplement. The software inherited by a subclass is considered reused in the subclass. In some cases, a subclass may customize or redefine a method inherited from the superclass. A superclass method which can be redefined in this way is called a virtual method.

4. Polymorphism

Polymorphism is a way to redefine methods, means one method name but with slightly different functionality.

Types of Polymorphism

There are two types of redefining methods.

  • Overloading
  • Overriding


In overloading, methods have the same name and same parameters as of the parent class. For method overloading, the compiler determines which method will be executed, and this decision is made when the code gets compiled, so,this is referred to as compile-time polymorphism.


In overridding, methods have the same name but with different parameters as of the parent class. Overloading, method will be used for method overriding is determined at run-time based on the dynamic type of an object. It is also called run-time polymorphism.

If you can grasp these four pillars of OOP, it can take you to the upper level in programming. Basically these are the main fundamentals of oop. It might take more than one read, I encourage you to practically try it.