Home >>C++ Tutorial >C++ OOPs Concepts

C++ OOPs Concepts

C++ OOPs Concepts

The C++ programming was developed in order to introduce the concept of the object orientation to the C programming language.

A pattern that avails many concepts like polymorphism, inheritance, data binding etc. is known as the object Oriented Programming in C++ or OOPs in C++.

The programming pattern where the representation of everything resembles of an object is called as truly object-oriented programming language. The first known truly object oriented programming language Smalltalk.

OOPs (Object Oriented Programming System)

An object simply means an entity of the real word like lunch, phone, bike etc. Object Oriented Programming is basically known to be a pattern that is used to design a program just by the use of objects and classes. This programming method in C++ generally simplifies the software development and the maintenance by providing some basic concepts that are as follows:

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

1. Class

A class is basically a logical entity and mainly a collection of objects.

2. Object

Object is basically anything that possesses state and behavior and can be either physical or logical. For example: phone, purse, bike etc.

3. Inheritance

The things or the properties and behaviors are generally acquired by one object from its parent object is known to be the inheritance. It enhances the code reusability and in order to achieve runtime of polymorphism.

4. Polymorphism

Polymorphism is the process where one task gets performed by various ways. In order to achieve the polymorphism in C++ , function overloading and function overriding is used.

5. Abstraction

Abstraction is generally known as the process of hiding internal details and displaying the functionality. Abstract class and interface is used to get the abstraction in C++.

6. Encapsulation

Encapsulation is basically binding or wrapping the code and the data into a single unit.

Advantage of OOPs over Procedure-oriented programming language

  • Development and maintenance is easier in OOPs and on the other hand it is difficult to manage the procedure-oriented programming language when the code evolves or the project size evolves.
  • Data-hiding is available in the OOPs, on the other hand the global data in the procedure oriented programming can be accessed from any part of the planet.
  • Users can simulate the real-world event very efficiently in OOPs whereas it is mildly difficult in Procedure oriented programming language.