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
};
```


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...

Which of the following regulates financial practices and corporate governance?

A) HITECH B) CFAA C) Sarbanes-Oxley D) HIPAA

Computer Science & Information Technology

To create a file, you can use __________.

a. FileOutputStream b. FileWriter c. RandomAccessFile d. All of the above.

Computer Science & Information Technology

Which of the following are personal video journal entries posted on the web?

A) Podcasts B) Newsgroups C) Blogs D) Vlogs

Computer Science & Information Technology

________ makes it now possible for data manipulation to be shared by the server and the client.

a) DHTML b) data binding c) TDC d) all of the above

Computer Science & Information Technology