ℹ️ Skipped - page is already crawled
| Filter | Status | Condition | Details |
|---|---|---|---|
| HTTP status | PASS | download_http_code = 200 | HTTP 200 |
| Age cutoff | PASS | download_stamp > now() - 6 MONTH | 0.5 months ago |
| History drop | PASS | isNull(history_drop_reason) | No drop reason |
| Spam/ban | PASS | fh_dont_index != 1 AND ml_spam_score = 0 | ml_spam_score=0 |
| Canonical | PASS | meta_canonical IS NULL OR = '' OR = src_unparsed | Not set |
| Property | Value |
|---|---|
| URL | https://www.tutorialspoint.com.cach3.com/what-is-an-arrow-operator-in-cplusplus.html |
| Last Crawled | 2026-04-03 10:15:54 (14 days ago) |
| First Indexed | not set |
| HTTP Status Code | 200 |
| Meta Title | What is an arrow operator, `->` in C++ |
| Meta Description | What is an arrow operator, `->` in C++ - The dot and arrow operator are both used in C to access the members of a class or structure They are just used in different scenarios In C types declared as class struct or union are considered of class type So the following refers to all t... |
| Meta Canonical | null |
| Boilerpipe Text | The dot and arrow operator are both used in C++ to access the members of a class or structure.
They are just used in different scenarios. In C++, types declared as class, struct, or union are
considered "of class type". So the following refers to all three of them.
a.b is only used if b is a member of the object (or reference to an object) a. So for a.b, a will
always be an actual object (or a reference to an object) of a class.
a->b is essentially a shorthand notation for (*a).b, i.e., if a is a pointer to an object, then a->b
is accessing the property b of the object that a points to.
Note that dot cannot be overloaded but -> can be overloaded, so we can define our own
function(operator->()) that should be called when this operator is used. so if a is an object of a class
that overloads operator-> (common such types are smart pointers and iterators), then the meaning
is whatever the class designer implemented.
References are, semantically, aliases to objects, so I should have added "or reference to a pointer"
to the as well. However, I thought this would be more confusing than helpful, since references to
pointers (T*&) are rarely ever used.
Example Code
#include<iostream>
class A {
public: int b;
A() { b = 5; }
};
int main() {
A a = A();
A* x = &a;
std::cout << "a.b = " << a.b << "\n";
std::cout << "x->b = " << x->b << "\n";
return 0;
}
Output
5
5 |
| Markdown | Please note, this is a STATIC archive of website www.tutorialspoint.com from May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.

[Home](https://www.tutorialspoint.com/index.htm "TutorialsPoint - Home")
[Q/A](https://www.tutorialspoint.com.cach3.com/questions/index.php.html "Questions & Answers - The Best Technical Questions and Answers - TutorialsPoint")
[Tools](https://www.tutorialspoint.com/online_dev_tools.htm "Tools - Online Development and Testing Tools")
[Coding Ground](https://www.tutorialspoint.com/codingground.htm "Coding Ground - Free Online IDE and Terminal")
[Current Affairs](https://www.tutorialspoint.com.cach3.com/current_affairs/index.htm "Current Affairs - 2016, 2017 and 2018 | General Knowledge for Competitive Exams")
[UPSC Notes](https://www.tutorialspoint.com/upsc_ias_exams.htm "UPSC IAS Exams Notes - TutorialsPoint")
[Online Tutors](https://www.tutorialspoint.com/tutor_connect/index.php "Top Online Tutors - Tutor Connect")
[Code Examples](https://www.tutorialspoint.com.cach3.com/programming_examples/index.html "Programming Examples")
[Whiteboard](https://www.tutorialspoint.com/whiteboard.htm "Free Online Whiteboard")
[Net Meeting](https://www.tutorialspoint.com.cach3.com/netmeeting.php.html "A free tool for online video conferencing")
[Articles](https://www.tutorialspoint.com/articles/ "Short Articles")
[](https://www.tutorialspoint.com/index.htm "Tutorialspoint")
[Library](https://www.tutorialspoint.com/tutorialslibrary.htm)
[Videos](https://www.tutorialspoint.com.cach3.com/videotutorials/index.htm)
[eBooks](https://store.tutorialspoint.com/)
- [Library](https://www.tutorialspoint.com/tutorialslibrary.htm)
- [Videos](https://www.tutorialspoint.com.cach3.com/videotutorials/index.htm)
- [eBooks](https://www.tutorialspoint.com/tutorialslibrary.htm)
- [Comments]("Comments")
- [Edit Question]()
- [Edit Categories]()
# What is an arrow operator, \`-\>\` in C++?
[C++](https://www.tutorialspoint.com.cach3.com/questions/category/Cplusplus.html)[Server Side Programming](https://www.tutorialspoint.com.cach3.com/questions/category/Server-Side-Programming.html)[Programming](https://www.tutorialspoint.com.cach3.com/questions/category/Programming.html)
[Follow]("0 Follower, Follow Question") [Answer]() [...]()
[**0**]("Upvote") [**0**]("Downvote")
**1 Answer**
[](https://www.tutorialspoint.com.cach3.com/profile/Maheshwari-Thakur-1.html "Maheshwari Thakur")
[Maheshwari Thakur](https://www.tutorialspoint.com.cach3.com/profile/Maheshwari-Thakur-1.html)
Answered on 14th Mar, 2019
The dot and arrow operator are both used in C++ to access the members of a class or structure. They are just used in different scenarios. In C++, types declared as class, struct, or union are considered "of class type". So the following refers to all three of them.
- a.b is only used if b is a member of the object (or reference to an object) a. So for a.b, a will always be an actual object (or a reference to an object) of a class.
- a-\>b is essentially a shorthand notation for (\*a).b, i.e., if a is a pointer to an object, then a-\>b is accessing the property b of the object that a points to.
Note that dot cannot be overloaded but -\> can be overloaded, so we can define our own function(operator-\>()) that should be called when this operator is used. so if a is an object of a class that overloads operator-\> (common such types are smart pointers and iterators), then the meaning is whatever the class designer implemented.
References are, semantically, aliases to objects, so I should have added "or reference to a pointer" to the as well. However, I thought this would be more confusing than helpful, since references to pointers (T\*&) are rarely ever used.
## Example Code
```
#include<iostream>
class A {
public: int b;
A() { b = 5; }
};
int main() {
A a = A();
A* x = &a;
std::cout << "a.b = " << a.b << "\n";
std::cout << "x->b = " << x->b << "\n";
return 0;
}
```
## Output
```
5
5
```
[Comments]("View Answer Comments") [Edit Answer]("Suggest/Edit Answer") [Report]()
[**0**]("Upvote") [**0**]("Downvote")
[Would you like to add a better answer?]()
Advertisements
[]() []() []() []() []() []()
Ask Question
Advertisements
### Follow
[](https://www.tutorialspoint.com/index.htm)
© Copyright 2019. All Rights Reserved.
### Newsletter
Disabled
- [Cookies Policy](https://www.tutorialspoint.com/about/about_privacy.htm#cookies)
- [FAQ's](https://www.tutorialspoint.com/about/faq.htm)
- [Helping](https://www.tutorialspoint.com/about/about_helping.htm)
- [Contact](https://www.tutorialspoint.com/about/contact_us.htm)
We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy. [Accept]() [Learn more](https://www.tutorialspoint.com/about/about_cookies.htm)
 |
| Readable Markdown | The dot and arrow operator are both used in C++ to access the members of a class or structure. They are just used in different scenarios. In C++, types declared as class, struct, or union are considered "of class type". So the following refers to all three of them.
- a.b is only used if b is a member of the object (or reference to an object) a. So for a.b, a will always be an actual object (or a reference to an object) of a class.
- a-\>b is essentially a shorthand notation for (\*a).b, i.e., if a is a pointer to an object, then a-\>b is accessing the property b of the object that a points to.
Note that dot cannot be overloaded but -\> can be overloaded, so we can define our own function(operator-\>()) that should be called when this operator is used. so if a is an object of a class that overloads operator-\> (common such types are smart pointers and iterators), then the meaning is whatever the class designer implemented.
References are, semantically, aliases to objects, so I should have added "or reference to a pointer" to the as well. However, I thought this would be more confusing than helpful, since references to pointers (T\*&) are rarely ever used.
## Example Code
```
#include<iostream>
class A {
public: int b;
A() { b = 5; }
};
int main() {
A a = A();
A* x = &a;
std::cout << "a.b = " << a.b << "\n";
std::cout << "x->b = " << x->b << "\n";
return 0;
}
```
## Output
```
5
5
``` |
| Shard | 126 (laksa) |
| Root Hash | 1076217839771841326 |
| Unparsed URL | com,cach3!com,tutorialspoint,www,/what-is-an-arrow-operator-in-cplusplus.html s443 |