Want to become a Vibe Coder? Join Vibe Coding Training here
x
C# Corner
Tech
News
Videos
Forums
Jobs
Books
Events
More
Interviews
Live
Learn
Training
Career
Members
Blogs
Challenges
Certification
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
602
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++