As I just learned, for a pointer p
there are two equivalent ways of accessing a member of the referenced object, namely p->foo
and (*p).foo
.
Are there technical arguments which is best to use?
Note: One argument I read about, is that .
is safer because it cannot be overloaded, while ->
can. I guess, however, there must be more arguments, as in most C++ code I work on I only see the ->
-construct.