Abstraction in C++

Prev Tutorial Next Tutorial

Abstraction in C++

Abstraction is the concept of exposing only the required essential characteristics and behavior with respect to a context.

Hiding of data is known as data abstraction. In object oriented programming language this is implemented automatically while writing the code in the form of class and object.

Real life example of Abstraction in C++

Abstraction shows only important things to the user and hides the internal details for example when we ride a bick, we only know about how to ride bick but can not know about how it work ? and also we do not know internal functionality of bick.

real life example of abstraction in c++

Example of Abstraction in C++


class sum
// hidden data from outside world
private: int a,b,c;

void add()
cout<<"Enter any two numbers: ";
cout<<"Sum: "<<c;
void main()
sum s;


Enter any two number: 
Sum: 9

Note: Data abstraction can be used to provide security for the data from the unauthorized methods.

Note: Note: In C++ language data abstraction can be achieve by using class.

Prev Tutorial Next Tutorial

Download Projects

Google Adsense Advertisements
Free Classified Site – Bedpage

Yahoo Advertisements