home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The C Users' Group Library 1994 August
/
wc-cdrom-cusersgrouplibrary-1994-08.iso
/
listings
/
v_10_01
/
1001098a
< prev
next >
Wrap
Text File
|
1991-11-17
|
318b
|
22 lines
Listing 8
//
// operator+=
//
rational &rational::operator+=(rational r)
{
num = num * r.denom + r.num * denom;
denom *= r.denom;
return *this;
}
//
// operator+ written in terms of operator+=
//
rational rational::operator+(rational r)
{
rational result(*this);
return result += r;
}