C++ Object Oriented Programming (OOP) Concepts2 min read

The main purpose of C++ is to introduce the OOPs concept in C programming language which is a powerful language.

OOP is a concept of using objects in programming. It is a paradigm that uses objects and classes that aim to implement real-world entities. The entities such as inheritance, abstraction, polymorphism, etc that are used in programming.

There are few main principles that form the foundation of Object-Oriented programming or you can say that they are the Characteristics of an Object-Oriented Programming language. They are:

  • Class
  • Object
  • Inheritance. 
  • Encapsulation. 
  • Abstraction. 
  • Polymorphism


Objects are real-world entities that have state and behavior. Example. bike, Lamp, pen, table, etc. An object is an instance of a class. It can be physical and logical.


A class is a user-defined blueprint or prototype for creating Objects. It is a logical entity. We can say that classes are categories, and objects are items within each of those categories. It holds the data members and member functions and these members of a class can be accessed and used by creating an instance of that class.


Inheritance is also one of the main concepts of OOP. Inheritance is one of the processes or mechanisms in OOP in which one class(sub-class) acquires the properties(data members) and functionalities(methods) of another class(parent-class).

This feature in C++ help to optimize the size of the code.

Super Class: The class whose properties and functionalities are inherited by the Subclass is known as the superclass(a parent class or a base class).

Sub Class: The class that inherits the property and behavior of the other class(Superclass) is known as a subclass( a derived class, extended class, or child class).


Data abstraction refers to the process of hiding the details but only displaying the relevant information to the world, which is hiding the implementation details and displaying only its functionalities.

Abstraction can be achieved in two ways.

  • Abstraction class.
  • Interfaces.


Encapsulation in C++ is defined as the wrapping up of data(variable) under a single unit. The use of Encapsulation is to make sure that implementation detail or we can say sensitive data is hidden from the users. Encapsulation is also known as data hiding


Polymorphism means having many forms, which means it is the way of performing some task in many ways. That means a single function or an operator functioning in many ways.

Function overloading and Function overriding are used in order to achieve Polymorphism. There is a Compile-time Polymorphism and Runtime Polymorphism.

We will learn about each of the above concept of OOP separately in details in the further tutorial.


Find the output ab, cd, ef, g for the input a,b,c,d,e,f,g in Javascript and Python

In this tutorial, we will write a program to find a pairs of elements from an array such that for the input [a,b,c,d,e,f,g] we will …

String Pattern Programs in C

In this tutorial, we will write various C pattern programs for String. Before that, you may go through the following topics in C. for loop …

Java Program to Find pair of Integers in Array whose sum is given Number

In this tutorial, we will write a program to find a pair of elements from an array whose sum equals a given number in java …

Program to Print Diamond Alphabet Patterns in C

In this tutorial, we will learn to write a C program to print Diamond patterns using alphabets/characters. However, in this tutorial, we will create a …

Half Diamond Pattern in C using Alphabets

In this tutorial, we will learn and code the half diamond alphabet patterns in C programming language. However, in this tutorial, we will create a …

Half Pyramid of Alphabets in C

In this tutorial, we will learn and code alphabet patterns in C programming language specifically the Half pyramid of alphabets in C programming. However, in …