i just have a question are this the same if not why or why not.
Code:x.y // member y of object by x x->y menber y of object by x but am i passing by reference right?
i just have a question are this the same if not why or why not.
Code:x.y // member y of object by x x->y menber y of object by x but am i passing by reference right?
No, x->y is equivalent to (*x).y, i.e., member y of object pointed to by x.
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
When you use x.y, x is an object instance, but in the case x->y then x is a pointer to an object you have created and you are accessing member y through the pointer to that object rather than through the object instance itself.
x->y is the same as (*x).y
and
x.y is the same as (&x)->y
Edit: Laserlight is quick off the button when it comes to answering questions, lol.
Last edited by Swarvy; 10-28-2010 at 10:22 PM.