Buckys C++ Programming Tutorials - 48 - friend
Top Comments
All Comments (74)
-
@prasungera Because if we don't use the address of the object, then the code will create a copy of the object rather than using the object itself. references (& symbol) make sure that the object you are modifying/using is the original object.
-
i should make a program that calculates the taimes the bucky says "PRETTY COOL HUH?"
-
@prasungera this is also another method of pass by reference using referencing operator! reduces memory variable usage.
-
A class that has friend must have a constructor?
-
@cubito455 oh yu mean in order to change the value of StinkFist's stinkyVar he's using address and to just read the stinkyVar we just need object's name,..k tnks buddy
-
@prasungera i know this questions is old, but i don't see any replies. He used the address of the object in order to change the value of stinkyVar otherwise stinkyVar would've stayed 0.
you can see that if you use a regular object (not the address) and create a getVar function to get the value of stinkyVar and call it after stinkyFriend.
I hope that makes any sense.
-
Bucky, i'm having trouble getting this to work when each class is in its own cpp file, perhaps due to a problem with recursive instantiation or just screwed up header files. Do you have any examples that might clear this up for me?
-
@gakusei26 Yes, you're doing jokes wrong.
-
what is the purpose and function of passing an object? This is the only part i do not get.... How does it work?
Hey Bucky PLS answer me, why you use the address of the object and not the object itself??
prasungera 9 months ago 35
i did everything as you told me to do last night with a girl,she added me to her 'friend' but still i don't have 'access' to her 'privates'
am i doing something wrong?
gakusei26 9 months ago 30