mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2024-11-22 21:52:31 +03:00
Grammar
the address
This commit is contained in:
parent
87e8e77e5f
commit
3b246fd869
@ -245,9 +245,9 @@ cout << fooRef; // Prints "I am foo. Hi!"
|
||||
// Doesn't reassign "fooRef". This is the same as "foo = bar", and
|
||||
// foo == "I am bar"
|
||||
// after this line.
|
||||
cout << &fooRef << endl; //Prints address of foo
|
||||
cout << &fooRef << endl; //Prints the address of foo
|
||||
fooRef = bar;
|
||||
cout << &fooRef << endl; //Still prints address of foo
|
||||
cout << &fooRef << endl; //Still prints the address of foo
|
||||
cout << fooRef; // Prints "I am bar"
|
||||
|
||||
//The address of fooRef remains the same, i.e. it is still referring to foo.
|
||||
|
Loading…
Reference in New Issue
Block a user