CPB Mailing List

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: overloaded operator friends



Some more thoughts on your situation...

Is there any specific purpose for these functions, or is it an
academic exercise?  I ask because I suppose operator= and operator<<
could be used for char *, but it's highly unusual.  The usual
signature and return values for these functions are:

HUGE& HUGE::operator= (const HUGE &that)
{
	...
	return *this;
}

ostream & operator<<( ostream &o, const HUGE &item)
{
	...
	return o;
}

That way these calls can be chained together:

HUGE h1, h2, h3;

h1 = h2 = h3;
o << h1 << h2 << h3;

- Keith


W Komornicki's Home Page | Main Index | Thread Index