OOP Concepts - Part One

OOP Concepts

OOP stands for Object Oriented Programming. It is a design philosophy, which acts as a base in implementing any modern day software.

Here, we will state some basic and simple OOP concepts in an easy way, that may help you in answering some basic OOP related questions in the interviews.

Everything in OOP revolves around the objects, that have certain properties and behaviors. Thus, what is an object?
Object is a foundational piece of OOP. Fundamentally, an object is like a modelling a concept. It may act as a container for the data. Lastly, an object is an instance of a class.

CLASS? What is this?

We can consider a class as a blueprint through which the objects are created. A class represents the type of an object.
Lets take an example to better understand the difference between a class and an object.

Hand is a class. It's a blueprint or a template, through which we can create the objects. Thus, rightHand and leftHand can be named as its two objects.

Quite simple right? Now let's try to understand few more concepts.

Any OOP based programming language has three key properties: Encapsulation, Polymorphism and Inheritence.
Encapsulation, in easy words, is a concept of putting a wall around your code. The goal is to separate the external behavior from the internal implementations and focus on "what" instead of "how".

Inheritence focuses on the concept of the code reusability. The object inherits from the other objects and uses their behavior.

Polymorphism - It is the ability to request the operations by a wide range of the different type of things.

I've tried to put these concepts in the simplest and easiest way so the beginners can understand. I'll discuss a few more in the next article.