[comp.lang.c++] C++ 2.0 question

kipp@warp.sgi.com (Kipp Hickman) (10/05/89)

So what the heck is overloading operator, (operator comma!) good for?
I can imagine several ugly things, but no nice ones...

					kipp

paul@zeek.UUCP (Paul T. Cottey) (10/06/89)

In article <803@odin.SGI.COM>, kipp@warp.sgi.com (Kipp Hickman) writes:
> 
> So what the heck is overloading operator, (operator comma!) good for?
> I can imagine several ugly things, but no nice ones...
> 
> 					kipp

Stroustrup, on page 122-3, suggests that a print function may be
overloaded to know how to print integers, floats, characters, etc.

He also states that in the cases of +, *, and <<, it would be 
essential to be able to call a different part of an overloaded function
depending on the type(s) of the operands.  For example, it is different
to multiply an integer by an integer than to multiply a float by an
integer.

It is a good idea to use "overload" with care.

Paul

uunet!zeek!paul