Reference variable doubt

i have used ostream os and not ostream &os as 1st argument inside operator<< function why it is giving error and not working.

hello @varu
we r passing it by reference to avoid copying time.
not any other reason.
for ur reference-> https://stackoverflow.com/questions/30272143/why-does-overloading-ostreams-operator-need-a-reference

but it should not give error then why it s

no it should not give any error.

please share ur code ,i will check

but it should not give error then why it is giving error

, , , , ,

please see line no.205

a) u r not returning anything from ur function

b) another reason why we pass as refernce is this->
image

and that is why we are passing it as refernce.
avoding copy is also one of the valid reason.

refer this-> link

ok,thanks you sir now i got it!