"->" and "."?

whats the difference between the two?
i know both are used to acces members of an object, but when do i use "->", and when do i use "."?
Last edited on
-> is a convenient shorthand for accessing members of a struct/class instance by a pointer

so you can write

1
2
MyObj* obj = <get-obj>
obj->method();


Instead of

1
2
MyObj* obj = <get-obj>
(*obj).method();

so -> is used when the pointer is pointing to an object, not to a variabel then?
x->y is nothing more than a short way of saying (*x).y!
yes, i already understood that part from the first reply. i simply asked when to use it...but i have allready figured it out so thanks for answering :P
Topic archived. No new replies allowed.