August 2001
Beginner
482 pages
10h 52m
English
You create a reference by writing the type of the target object, followed by the reference operator (&), followed by the name of the reference. References can use any legal variable name, but for this book we'll prefix all reference names with r. So, if you have an integer variable named someInt, you can make a reference to that variable by writing the following:
int &rSomeRef = someInt;
This is read as “rSomeRef is a reference to an integer that is initialized to refer to someInt.” Listing 11.1 shows how references are created and used.
The reference operator (&) is the same symbol as the one used for the address of the ... |
Read now
Unlock full access