When I call getCount function in the below code, QT 4.7.3 complier giving the error. Build Error
pasing ‘cont Person’ as ‘this’ argument of ‘int Person::getCount(const QString&) discards qualifiers
bool Person::IsEligible(const QString& name)
{
int count = 0;
count = getCount(name);
}
int Person::getCount(const QString& name)
{
int k =0
return k;
}
The error isn’t a problem with passing string arguments, it’s that you’ve got a
constperson, e.g.:If
IsEligibleis meant to be callable onconst Persons then you can say:(and change the corresponding declaration that you’ve not shown too obviously), but I’m not 100% sure that’s what you intended to do.