Make toAssending() a non-member function.
class Student
{
...
};
bool toAssending( const Student & s1 , const Student & s2 )
{
cout<<"\n" << __FUNCTION__;
return s1.getRollNo() < s2.getRollNo();
}
int main()
{
...
qSort( studentList.begin() , studentList.end(), toAssending );
...
}
class Student
{
...
};
bool toAssending( const Student & s1 , const Student & s2 )
{
cout<<"\n" << __FUNCTION__;
return s1.getRollNo() < s2.getRollNo();
}
int main()
{
...
qSort( studentList.begin() , studentList.end(), toAssending );
...
}
To copy to clipboard, switch view to plain text mode
Bookmarks