Another (somewhat) similar concept is a reference type. A reference type is an alias to an existing object in memory. References must be initialized. We describe a reference type as type_name followed by an ampersand &. Example:
int main()
{
int x = 123;
int& y = x;
}
Now we have two different names that refer to the same int object in memory. We can visualize the object in memory using the following image:
An illustration ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month, and much more.