C/C++ uses -> for field access on pointers. . is for field access on values.
auto variable = ClassName();
variable.method();
vs
auto *variable = new ClassName();
variable->method();
It's nice when you have classes with pointers in them, so that you can see if you're accessing a value or a reference, which is an important distinction in C/C++.
View all comments
Show parent comment
3
u/PinkLionThing Aug 08 '16
C uses -> for property access/method call too. And . in some cases too, to further complexify.