For the following code:
class C
{
public:
void fun() const {};
void fun() const & {};
};
I know that this is illegal, since we cannot overload with const
and const &
. However, my question is: we already have const
member function in the old standard, why did we need to introduce the const &
member function? Are there any semantic differences between a const
member function and a const-ref
member function?