+ 2

Anyone explain me something....

I just created two programs of friend function see below,in c++ course they told that we have to pass object by reference.When i pass it by value its output is same?Explain. "https://code.sololearn.com/coJxRfvk7HgY/?ref=app" "https://code.sololearn.com/c21xPuhNAVA4/?ref=app"

14th Jan 2018, 6:25 AM
Mohd Zaki
Mohd Zaki - avatar
1 Resposta
+ 2
pass by reference - giving you the power to change his values. pass by value - creating totally new object, which you accessed him. when you using 'friend' on some class it doesn't mean you always have to pass by reference to access his values.
14th Jan 2018, 6:30 AM
Cain Eviatar
Cain Eviatar - avatar