Understanding the Object-Oriented Programming

A programming paradigm in which emphasis is given on data rather than process

Photo by Arian Darvishi on Unsplash

Object-Oriented Programming is a design philosophy also known as OOP. Object-Oriented Programming(OOP) uses different sets of programming languages than old procedural programming languages(C, Pascal, etc.)Everything in OOP is grouped as self-sustainable “objects”. Hence you gain reusability by means of OOP concepts.

OOP allows the decomposition of a problem into a number of entities called objects and then builds data and functions around these objects. Data cannot be accessed directly, they are only accessible through the member function. There might be a number of objects in a program written in OOP language. Those objects can communicate with each other by calling their respective member functions. Organization of data and function in OOP is shown below:

Organization of data and functions in OOP

OOP has taken the best ideas of structured programming and combined them with several powerful new concepts that encourage us to perform the task of programming in a new way. In general, when programming in an object-oriented fashion, we break down a problem into a subgroup of related parts that take into account both code and data related to each group.

The terminology used in OOP:


An object is any entity, thing, or organization that exists in the real world, It consists of two fundamentals characteristics: its attributes and behaviors. For example, a dog is an object having attributes such as color, weight, age, etc, and behaviors such as barking. In OOP, attributes are represented by data(variables) and the behaviors are represented by the functions.

Object CarData                              Function
plateNumber = 120 accelerate()
speed = 100
color = black

Objects are the basic run-time entities in an object-oriented system that may be created or destroyed at run time. The data and function containing in an object are called its member data and member function. The member function of an object can only access its data. The concept behind OOP is to integrate both data and function into a single entity. This entity is also called an object.


A class is simply a representation of a type of object. It is the blueprint/prototype that describes the details of an object. The entire set of data and code of an object can be made a user-defined data type with the help of a class. Once a class has been defined, we can create any number of objects associated with that class. For example, mango, apple, and orange are members of class fruit. If the fruit has been defined as a class, then the statement fruit mango will create an object mango belonging to the class fruit.

A class has three areas: public, private, and protected. The functions and variables defined inside the public areas can be accessed by any object. The functions and variables defined inside the private areas can be accessed by the object of the same class and the protected areas can be accessed by the object from the same class and derived class. It incorporated the concept of data hiding.

Class Student                     Class Vehicle
Id Name
Name Maker
getName() Engine
printGrade() getDetails()

Defining class doesn't create an object but class is the description of the object’s attributes and behavior. So no memory is allocated when a class is created.

Data Abstraction & Encapsulation

In OOP, abstraction defines the conceptual boundaries of an object. Abstraction is the act of representing essential features without including the background details. It focuses on the outside view of an object, separating its essential behavior from its implementation. To understand this concept, take an example of ‘switch-board’. We only press particular switched as per our requirement. We need not know the internal working of these switched. This is an abstraction where we only know the essential things to operate on a switch-board without knowing the background details of the switch-board.

Encapsulation is a way of organizing data and function into a structure (called class) by concealing (hiding) the way the object is implemented, which is preventing access to data by any means other than those specified. Encapsulation, therefore, guarantees the integrity of the data contained in the object. The best application of encapsulation is making the data fields private and using public access to functions. However, we cannot hide an entire object. To use an object, a part of it needs to be accessed by users. To provide this access, abstraction is used. Abstraction provides access to a specific part of data while encapsulation hides the data. Therefore, abstraction and encapsulation complement each other.


The process of creating a new class from an existing class in which objects of the new class inherit the attributes and behaviors of the existing class is known as inheritance. The newly created class is called the derived class or child class or subclass and the class from which the new class is created is class base class or parent class or super-class.
The relationships of classes through inheritance give rise to a hierarchy. It permits the expansion and reuse of existing code without rewriting it hence, the concept of inheritance supports the concept of reusability.


  1. Single Inheritance: The process of creating a new class from an existing class is a single inheritance that is there is only one base class and only derived class in single inheritance.
fig. single Inheritance

2. Multiple Inheritance: The process in which one class can have more than one superclass and inherit features from all parent classes is multiple inheritances.

fig. multiple inheritance

3. Hierarchical Inheritance: The process of creating several classes from only one class is called hierarchical inheritance that is there are two or more derived classes and only one base class in hierarchical inheritance.

fig. hierarchical Inheritance

4. Multilevel Inheritance: The process of creating a new class from another derived class is called multi-level inheritance.

fig. multilevel Inheritance

5. Hybrid Inheritance: It is the combination of two or more types of inheritance.


Polymorphism is a generic term that means ‘many forms’. It simply means ‘one name many forms’. More precisely Polymorphism means the ability to request that the same operations be performed by a wide range of different types of things.

Polymorphism is an important feature of OOP which refers to the ability of an object to take on different forms depending upon situations. It simplifies coding and reduces the rework involved in modifying and developing an application. It is extensively used in implementing inheritance.

Example of Polymorphism

Operator overloading and function overloading are examples of polymorphism in OOP.


The concept of an object helps to translate our thoughts into a program. It provides a way of solving a problem in the same way as a human being perceives a real-world problem and finds out the solution. It is possible to construct large reusable components using object-oriented techniques.

Thanks for your time!! Hope you like it 😃😃

Tech Enthusiast | Student

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store