Advertisement
Guest User

Untitled

a guest
Mar 21st, 2019
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. class Money{
  6. public:
  7. int rands;
  8. int cents;
  9.  
  10. Money();
  11. Money(int rands,int cents);
  12. Money operator+(Money* obj,Money* obj2){return obj};
  13. };
  14.  
  15. Money::Money(){
  16. rands = 0;
  17. cents = 0;
  18. }
  19.  
  20. Money::Money(int randsN, int centsN){
  21. rands = randsN;
  22. cents = centsN;
  23. }
  24.  
  25. Money Money::operator+(Money *obj , Money *obj2){
  26. obj.rands += obj2.rands;
  27. obj.cents += obj2.cents;
  28.  
  29. return obj;
  30. }
  31.  
  32. int main(){
  33. Money totalCash=Money();
  34.  
  35. Money cash = Money(200,20);
  36. Money cashTwo = Money(100,10);
  37.  
  38. totalCash = cash + cashTwo;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement