Object-Oriented Programming (for Beginners)

Krishnkant Jaiswal
3 min readDec 27, 2020

Before directly jumping into Object-Oriented Programming(OPP) one should first understand “What is Object?”. Just look around you. whatever you see or sense or feel everything is an Object. Every object has its own set of features and functions. Using this Object as a concept and implementing it using any programming language is called object-oriented programming.

Four pillars of OPP

Since now we know that what is an object and what is Object-oriented programming. Let's see the four properties that every OPP must-have.

Encapsulation

Encapsulation means putting things in a single capsule(or Box) and treating this capsule as a single unit. Object-oriented programming has the property that all the features and functions of an object are inside the object and we treat this object as a single unit.

Let's take the example of your phone it has many features and functions like make a call, playing songs, playing games, it has its own color, weight, screen size, and many more. All these features and functions belong to your phone but you treat that as a unit, not by a group of features and function this concept is known as Encapsulation.

Abstraction

Abstraction means hiding unnecessary information and showing useful things. Suppose you want to take a selfie on your mobile. What will you do? Just open a camera click on the button and you did you. You don’t know what is going inside your mobile and still, you did what you wanted this concept is known as Abstraction and it is one of the important properties of Object-Oriented Programming.

Polymorphism

Polymorphism means having more than one form. In object-oriented programming, we can use the same function many times with different signatures in that way the same function will be performing different tasks. suppose you want to calculate the area of a triangle or rectangle or circle or hexagon in that case you can use different functions with the same name “area”.

Inheritance

Inheritance means taking some properties and features from someone. There are the following five types of inheritance which we can see in object-oriented programming.

In object-oriented programming, this inheritance feature gives us the power not to write the same thing again and again but simply inherit from someone else if it is already there.

If any programming language has above mentioned 4 properties it will fall into the category of object-oriented programming.

--

--