Abstraction in C++

  • The mechanism of representing only essential features without showing the unwanted background details is called abstraction.

  • Data abstraction refers to, providing only essential information to the outside world and hiding their background details, i.e., to represent the needed information in program without presenting the details.

Let's talk about real life example:

Abstraction shows only important things to the user and hides the internal details for example when you ride a bike, you only know about how to ride bike but do not know about how it work ? and also you do not know internal functionality of bike.
When you accelerate bike speed get fast, when push break it gets stop, you only know that these things have these functionality but do not know how they perform .

In C++ program if we implement class with private and public members then it is an example of data abstraction.

Example of Abstraction
using namespace std;  
 class Sum  
// hidden data from outside world 
int x, y, z;  
void add()  
cout<<"Enter two numbers: ";  
z= x+y;  
cout<<"Sum of two number is: ";
cout<< z<< endl;  
int main()  
Sum sm;  
return 0;  
Enter two numbers:
Sum of two number is: 8

Next topic is Inheritance


Training For College Campus

We offers college campus training for all streams like CS, IT, ECE, Mechanical, Civil etc. on different technologies like
C, C++, Data Structure, Core Java, Advance Java, Struts Framework, Hibernate, Python, Android, Big-Data, Ebedded & Robotics etc.

Please mail your requirement at info@prowessapps.in

Projects For Students

Students can contact us for their projects on different technologies Core Java, Advance Java, Android etc.

Students can mail requirement at info@prowessapps.in


(8AM to 10PM):

+91-8527238801 , +91-9451396824

© 2017, prowessapps.in, All rights reserved