Answer the question
In order to leave comments, you need to log in
What is the difference between the -> operator and .(dot) operator?
I have a simple question, why is the -> operator used when referring to a dynamic class object, and not . ? Yes, the IDE (In my case, Visual Studio 2019) itself replaces the "dot" with an "arrow", but why is this so? What's the Difference?
Answer the question
In order to leave comments, you need to log in
a -> b is a shorter notation for (* a ). b
That is, an arrow combines a pointer dereference and a method call.
Well, if a is a class, then the arrow operator can be defined in it at the request of the class author.
The compiler does not replace anything - apparently this is what your IDE does.
The difference is in the purpose. You will find in any textbook on pluses.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question