importance of returning reference in operator overloading.
I would like to know the "importance of returning reference in operator overloading." I searched on internet, even I could understand it but not able to digest it. there is some concept like operator chaining. If overloaded operator wont return reference, we could not perform chained operation with user defined data type like class sample
create three object sample t = a+b+c;
but I tried with and without "retrun reference" of operator+().It was working fine
not what is the use of returning reference from overloaded operator.
can somebody explain me with an example?
I tried with ostream and istream overloaded, for that compiler is restricting & in retrun value. IF I remove it I am getting compilation error.
Please explain on this.
Your help will be highly appreciated
Thansk in Advance,