CodesJava

Easy learning with example program codes

CPP Data Abstraction


CPP introduced the features of OOPs Concept, i.e, CPP is an object-oriented programming language which uses classes and objects for computations. However, it is not considered to be truly object-oriented programming language. An object oriented programming is based on seven fundamental principles, including data abstraction. OOPS Data Abstraction feature is used for hiding internal details and showing the functionality only.

Example:

#include <iostream.h>  
using namespace std;  
class Multiply  
{  
private: int a, b, c, d;  
public:  
void mul()  
{  
cout<<"Enter three numbers: \n";  
cin>>a>>b>>c;  
d= a*b*c;  
cout<<"Your answer is: "<<d<<endl;  
}  
};  
int main()  
{  
Multiply m;  
m.mul();  
return 0;  
}

Output

Enter three numbers: 
2     
4   
6  
Your answer is: 48
Posted in CPP   
Sign Up/ Sign In
Ask a Question


Industrial Training

We offers Placement Oriented Training on Java, Spring, JSF, Hibernate, PHP, AngularJS, Angular 4, PLSQL, Oracle BI Publisher etc. We also provides Online training, please mail us at hr@codesjava.com.

Development

We also provides the Development services for Website Development , Java Development, PHP Development, Android App Development etc. You can contact us on hr@codesjava.com.

Copyright © 2018 CodesJava DMCA.com Protection Status SiteMap Reference: Java Wiki