Question: Operator Overloading with Currency Consider the following implementation of the US_Currency class. class US_Currency { public: US_Currency (int dollars, int cents_) dollars(dollars_ + cents_ /


Operator Overloading with Currency Consider the following implementation of the US_Currency class. class US_Currency { public: US_Currency (int dollars, int cents_) dollars(dollars_ + cents_ / 100), cents(cents_ % 100) {} US_Currency() : dollars (O), cents() {} // Adds rhs to this US_Currency & operator+=(const US_Currency &rhs); int get_dollars() const { return dollars; } int get_cents() const { return cents; } private: int dollars; // INVARIANT: 0
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
