Buckys C++ Programming Tutorials - 48 - friend

Loading...

Sign in or sign up now!
Alert icon
Upgrade to the latest Flash Player for improved playback performance. Upgrade now or more info.
13,726
Loading...
Alert icon
Sign in or sign up now!
Alert icon

Uploaded by on Apr 17, 2011

For all of our videos, visit http://thenewboston.com

  • likes, 3 dislikes

Link to this comment:

Share to:

Top Comments

  • Hey Bucky PLS answer me, why you use the address of the object and not the object itself??

  • 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?

see all

All Comments (74)

Sign In or Sign Up now to post a comment!
  • @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?

Loading...

Alert icon
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more