What do you need to add to the class definition to overload operator < so that it applies to the type Money from Display 8.1? Given this extract from the class Money from Display 8.1 of the text.

```
class Money{public: Money( ); // other constructors
// other public members int getCents( ) const; int
getDollars( ) const;private:
int dollars;
int cents;
// other private members
};
```What will be an ideal response?


For non-member, non-friend operator overloading. add the following declaration and definition as appropriate file. The syntax here is for a definition outside the class.
```
bool operator < (const Money& amt1,const Money& amt2);
bool operator < (const Money& amt1, const Money& amt2)
{
int dollars1 = amt1.getDollars( );
int dollars2 = amt2.getDollars( );
int cents1 = amt1.getCents( );
int cents2 = amt2.getCents( );
return ((dollars1 < dollars2) ||
((dollars1==dollars2)==;(cents1 < ```

Computer Science & Information Technology

You might also like to view...

This term indicates that IPv4 and IPv6 are running at that same time.

What will be an ideal response?

Computer Science & Information Technology

Which of the following is NOT a reason for a database administrator to understand the main file types used in a SQL Server system?

A. physical resources B. transparency to the user C. backup and recovery operations D. security

Computer Science & Information Technology

Why is it important to understand how to convert decimal numbers to binary numbers?

What will be an ideal response?

Computer Science & Information Technology

Which of the following messages do router send to inform a host of a better first-hop router for a destination?

A. Route Advertisement B. Neighbor Advertisement C. Route Solicitation D. Redirect

Computer Science & Information Technology