-
Beginner's Question
I was just reading through C++ Annotations and I am at the point where the author is starting with classes. I noticed that the author declares one of the member functions
Code:
std::string const &name() const;
and I was wondering what would be the ultimate difference if
Code:
std::string const name() const;
was used instead. The function just returns the name but I am curious as to what this would mean with a more complex function.
Thanks in advance,
M
-
Oh, is the & symbol referring to the return value? This might just be a reading issue for me but I just wanted to make sure.
M
-
Yes, it says that name() returns a const reference.
-