Whats the difference between using -> and using . ?

Jan 8, 2019 at 1:25pm
In c++ you can do Class. and Class->. What are those, when are they used?
Jan 8, 2019 at 1:42pm
-> is used to reference members of the class when the instance of that class is a pointer.
. is used to directly access the members of the class. For non pointer objects.
Jan 8, 2019 at 2:24pm
Or, to put it another way:

a->b

is exactly the same as:

(*a).b
Jan 8, 2019 at 3:06pm
> In c++ you can do Class. and Class->.
not really
you may do object. or pointer->
or object-> if you overload the arrow operator
Jan 9, 2019 at 9:42am
Thanks all
Topic archived. No new replies allowed.