hi, i have some idea about operator overloading . in fact i have practised one sample program for addition of complex number by overloading '+' operator. those were simple program to implement and understand.
but i could not understand if it ususes strems . i have seen many codes that returns streams reference and also taking argument streams.
ostream& operator<<(ostream& c,x& a) ---- // line 1
or sometimes like....
some_stream_reference & some_operator( some_stream_reference & , may_be_some_other_arguments)
i stumble and feel uncomfortable when i see strem reference (like ostream& ) . what it means ? when i should use it ?
in the complex number addition we wrote
complex operator + (complex a, complex b) // its so simple !!
but look // line 1 ...its returning a reference !!
i see there is a some variation in this two approach . can anybody tell me in a simple way what is happening at the stream reference ?
is it necessary to use reference only when comes about streams !!