--- In [email protected], Gopi Krishna Komanduri
<gopikomand...@...> wrote:
>
> Hi,
>    I have a small query. why we need to return reference in prefix
operator overloading. Because, when we call as ++obj , the operator ++
method will be called and we increment the values using this pointer.
I will paste the code. Please let me know where I failed.

If the return type is void you will not be able to assign it....
<snip> 
>     ++obj1;

obj2 = ++obj1; // Something like this will not work!

And yes, for portability, I would say please do not use non-standard
headers like conio.h.

Thanks and Regards,
Saurabh

Reply via email to