Header
class Player {
protected:
int age;
string name;
public:
int getAge();
string& getName() const;
Definition
string& Player::getName() const
{
return name;
}
I get the following error when using the getName()
function:
error: qualifiers dropped in binding reference of type string to initializer of type const string
How do I fix it and make it work?