|
-
Apr 24th, 2002, 05:48 PM
#1
What is ->
i've seen -> between say varibles and functions, what does it do?
NOMAD!
-
Apr 24th, 2002, 06:07 PM
#2
When you use a struct or class, and use its members, you usually use the . operator. But, when you use a pointer to a struct of class, you use the -> operator instead.
Z.
-
Apr 24th, 2002, 06:26 PM
#3
Wow, thats simple. Thanks Zaei!
NOMAD
-
Apr 24th, 2002, 06:42 PM
#4
Frenzied Member
Basically,
object->method();
is equivalent to
(*object).method();
it gets very handy when you're chaining pointers to things together like this:
object->subobject1->subobject2->subobject3->method()
which would otherwise be
(*(*(*(*object).subobject1).subobject2).subobject3).method()
Harry.
"From one thing, know ten thousand things."
-
Apr 24th, 2002, 06:44 PM
#5
Frenzied Member
Oh yes, and if you want to know their proper names:
. is the 'direct member access operator'
and
-> is the 'indirect member access operator'.
Harry.
"From one thing, know ten thousand things."
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|