The perfect place for easy learning...

C++ Programming

×

Topics List


OOP Concepts





The main aim of the C++ programming language was to add the concepts of object-oriented programming paradigm to the procedure-oriented programming paradigm like C programming language. The following are the object-oriented programming concepts.

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

Object

An object is any real-time entity with some properties and behaviors. The object is the basic unit of the object-oriented programming paradigm. The properties of an object are the data values, and the behaviors are the functionalities that are associated with it. In object-oriented programming, the objects are created through the concept of class.

Class

A class is a collection of data and code where data is defined as variables and code like methods. By creating the class, we can define a blueprint of an object. Every class in OOPs defines a user-defined data type. The data and code defined in a class are said to be the members of that class (data members and member functions respectively).

Encapsulation

Encapsulation is the process of combining data with code into a single unit (class/object). We use the concept of class and object to implement encapsulation. The encapsulation aims to avoid the access of private data members from outside the class. So it binds the data members with member functions.

Abstraction

Abstraction is the process of hiding unnecessary details and showing only useful details to the end-user. Using the abstraction concept, the actual business logic is hidden from the users and shown only required things to solve the problem.

Inheritance

Inheritance is the process of acquiring properties from one object to another object. In other words, inheritance is the process of deriving a new class from an existing class where the members of the existing class are extended to the newly derived class. Here, the existing class is called a base class or a superclass or a parent class, and the newly created class is called a derived class or a subclass or a child class. The inheritance concept enables a major feature called code reusability.

Polymorphism

Polymorphism is the process of defining a single function with different functionalities (or) definitions. It is implemented using the concepts of function overloading and overriding.
In C++, we also have a feature of operator overloading.