diff options
author | Vojta Svoboda <vojtasvoboda.cz@gmail.com> | 2015-10-07 14:26:18 +0200 |
---|---|---|
committer | Vojta Svoboda <vojtasvoboda.cz@gmail.com> | 2015-10-07 14:26:18 +0200 |
commit | bff40e2f9816974abd29322f2a50455f51acd22e (patch) | |
tree | 01177dd231841fea5dea3aa6546fde8d6630f5d3 /c++.html.markdown | |
parent | 6dabd9568d2a99e7bbc079d0466588bf68a42283 (diff) | |
parent | 5c677e8071291520297ef3d5d8374c6d11285744 (diff) |
Merge branch 'master' into translation/brainfuck-cs
Diffstat (limited to 'c++.html.markdown')
-rw-r--r-- | c++.html.markdown | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/c++.html.markdown b/c++.html.markdown index 4acc1b9d..6f4d0562 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. @@ -258,7 +264,7 @@ string retVal = tempObjectFun(); // What happens in the second line is actually: // - a string object is returned from tempObjectFun -// - a new string is constructed with the returned object as arugment to the +// - a new string is constructed with the returned object as argument to the // constructor // - the returned object is destroyed // The returned object is called a temporary object. Temporary objects are |