Make toAssending() a non-member function.
Qt Code:
  1. class Student
  2. {
  3. ...
  4. };
  5.  
  6. bool toAssending( const Student & s1 , const Student & s2 )
  7. {
  8. cout<<"\n" << __FUNCTION__;
  9. return s1.getRollNo() < s2.getRollNo();
  10. }
  11.  
  12. int main()
  13. {
  14. ...
  15. qSort( studentList.begin() , studentList.end(), toAssending );
  16. ...
  17. }
To copy to clipboard, switch view to plain text mode