Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- class Money{
- public:
- int rands;
- int cents;
- Money();
- Money(int rands,int cents);
- Money operator+(Money* obj,Money* obj2){return obj};
- };
- Money::Money(){
- rands = 0;
- cents = 0;
- }
- Money::Money(int randsN, int centsN){
- rands = randsN;
- cents = centsN;
- }
- Money Money::operator+(Money *obj , Money *obj2){
- obj.rands += obj2.rands;
- obj.cents += obj2.cents;
- return obj;
- }
- int main(){
- Money totalCash=Money();
- Money cash = Money(200,20);
- Money cashTwo = Money(100,10);
- totalCash = cash + cashTwo;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement