Object-Oriented Programming (OOP) is the most popular paradigm of programming and is the standard way to code for programmers. OOP works on the concept of classes and objects. It structures a software program into simple, reusable pieces of code called classes for creating individual objects. C++ is an object-oriented programming language, and abstraction in C++ is one of the most important C++ features and the highlight of this article.

Object-oriented programming is meant to enhance the flexibility of the program. In this article, you will learn about how data abstraction is carried out in the C++ program along with the benefits of doing it.

**Data Abstraction in C++ **

Abstraction is derived from two Latin words, ‘abs’, which means ‘away from’ and ‘traction’ meaning ‘to draw’, refers to representing required essential features without including the whole details.

C++ classes perform abstraction with the list of abstract attributes such as functions. They put all the essential properties of an object to be created. _T_he attributes are called data members, and the functions that operate on them are called member functions. C++ classes using the data abstraction concept are termed abstract data types.


While using a class, data members and member functions are represented in the code. But, the built-in data types and the members in the class get ignored while using an object which is known as data abstraction.

Real-Life Examples Demonstrating Abstraction

The abstraction is a feature of Object-Oriented Programming, where only relevant details are shown to the user and irrelevant details are hidden.

You can understand Abstraction in C++ with these examples,

When an email is sent, you just click send and you get the sent receipt. What is abstracted here is the data transferred to the recipient.

The important features of a phone are the memory card, SIM, battery life, design, and processor. While operating the phone you do not get into the operational details of the phone such as CPU memory allocation for the various media that are invisible to you. You can use only certain commands and buttons on your phone without knowing what is happening inside your phone.

A man driving a car knows that pressing the accelerators will increase the speed of the car but he does not know-how, which is nothing but abstraction.

#abstraction in c++ #c++

What is Abstraction in C++? With Real Life Example and Its Implementation
1.40 GEEK