Example & Tutorial understanding programming in easy ways.

Define abstraction in C++

What is Data abstraction:
-Data abstraction refers to providing only essential information to the outside world and hiding their background details.
-Data abstraction is a programming technique that relies on the separation of interface and implementation.
-In C++, classes provides great level of data abstraction. They provide sufficient public methods to the outside world to play with the functionality of the object and to manipulate object data, i.e., state without actually knowing how class has been implemented internally.


#include < iostream>
using namespace std;
class Myclass{
// constructor
Myclass(int i = 0) {
total = i;
// interface to outside world
void addNum(int number) {
total += number;
// interface to outside world
int getTotal() {
return total;
// hidden data from outside world
int total;
int main() {
Myclass obj;
cout << "Total " << a.getTotal() << endl;
return 0;


Total 60

Read More →
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!