diff options
author | ven <vendethiel@hotmail.fr> | 2015-10-04 21:08:07 +0200 |
---|---|---|
committer | ven <vendethiel@hotmail.fr> | 2015-10-04 21:08:07 +0200 |
commit | a07e94471412edbf7b5a95bfd81fa732cb2e66d7 (patch) | |
tree | 4273b0cbf6d7ff2afda6d79f0725252ba15e1bb9 /c++.html.markdown | |
parent | 088114711b0cc13c1b58a25649fd4daa116e42e8 (diff) | |
parent | 3b246fd869564b0a7f7c847f44aecac82d318c78 (diff) |
Merge pull request #1328 from thePsguy/patch-1
{C++}Clarified fooRef address.
Diffstat (limited to 'c++.html.markdown')
-rw-r--r-- | c++.html.markdown | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/c++.html.markdown b/c++.html.markdown index 4acc1b9d..8ee964ca 100644 --- a/c++.html.markdown +++ b/c++.html.markdown @@ -245,7 +245,13 @@ 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 the address of foo fooRef = bar; +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. + const string& barRef = bar; // Create a const reference to bar. // Like C, const values (and pointers and references) cannot be modified. |