What is the difference between marking a function const
vs const&
of a class?
For example:
class abc {
Private:
std::string str;
Public:
const std::string& foo(const int&) const&;
const std::string& bar(const int&) const;
}
Is there any difference between them? When would you use one over the other?