Possible Duplicates:
What is the difference between the dot (.) operator and -> in C++?
What is the arrow operator (->) synonym for in C++?
The header says it all.
What does -> mean in C++?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It’s to access a member function or member variable of an object through a pointer, as opposed to a regular variable or reference.
For example: with a regular variable or reference, you use the
.operator to access member functions or member variables.But if you’re working with a pointer, you need to use the
->operator:It can also be overloaded to perform a specific function for a certain object type. Smart pointers like
shared_ptrandunique_ptr, as well as STL container iterators, overload this operator to mimic native pointer semantics.For example: