C++ references

Assigning reference return value to a variable When assigning a reference return value to a variable, a copy is made. Here is an example: class References { private: std::string name; public: References(const std::string& name) : name(name) { }; virtual ~References() { }; const std::string& getName() const { return name; }; }; References r(“foo”); std::string n […]