C# Corner
Tech
News
Videos
Forums
Trainings
Books
Events
More
Interviews
Jobs
Live
Learn
Career
Members
Blogs
Challenges
Certifications
Bounties
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Refer
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
Learn About The Data Abstraction In C++
WhatsApp
Logesh Palani
Aug 16
2016
609
0
0
#include <iostream.h>
using
namespace
std;
class
Add{
public
:
Add(
int
i = 0)
{
total = i;
}
void
add Num(
int
number)
{
total += number;
}
int
get Total()
{
return
total;
};
private
:
int
total;
};
int
main( )
{
Adder a;
a.addNum(10);
a.addNum(20);
a.addNum(30);
cout <<
"Total "
<< a.getTotal() <<endl;
return
0;
}
Output
Total 60
Data Abstraction
C++
Up Next
Learn About The Data Abstraction In C++