< Previous | Contents | Next >
Next I assign a returned reference to another reference with the following line, which takes a reference to the element in position 1 of inventory and assigns it to rStr.
string& rStr = refToElement(inventory, 1);
This is an efficient assignment because assigning a reference to a reference does not involve the copying of an object. Then I send rStr to cout, and armor is displayed.