Object Oriented Programming Concepts

Four pillars of OOPs are:

  1. Encapsulation
  2. Abstraction
  3. Inheritance
  4. Polymorphism

Encapsulation is a mechanism of wrapping the data (instance variables/properties) and behaviour (methods) together as a single unit like a Class.
In encapsulation, the variables of a class can be protected from other classes through access modifiers, and can be accessed only through the methods of their current class. Therefore, it is also known as data hiding.
Encapsulation leads to data hiding.

Abstraction is a process of hiding the implementation details from the user, only the functionality will be provided to the user.
In other words, the user will have the information on what the object does instead of how it does it.

Inheritance can be defined as the process where one class acquires the properties (methods and fields) of another.

In object-oriented programming, polymorphism (from the Greek meaning “having multiple forms”) is the characteristic of being able to assign a different meaning or usage to something in different contexts — specifically, to allow an entity such as a function, or an object to have more than one form.

There are 2 types of polymorphism implementations:

  • Static Polymorphism
  • Dynamic Polymorphism

Author: Mahesh

Technical Lead with 10 plus years of experience in developing web applications using Java/J2EE and web technologies. Strong in design and integration problem solving skills. Ability to learn, unlearn and relearn with strong written and verbal communications.