What is the difference between operators “.” and “->”? When should each of them be used?
1
Expert's answer
2010-08-09T10:37:39-0400
Operators “.” and “->” are class member selectors. The first is used to access the members of the class directly from the object. The second – from the pointer to this object. However, if the class is non-trivial, you have the possibility to overload the operator “->” and return a pointer to another object, whose methods and will be called.
Comments
Leave a comment