I have following class.
class Student {
//Parameterized constructor.
private:
int rollNo;
char* name;
float marks;
}
I have a set<Student> students
. When I insert a student object in set, how can I sepcify that two objects are same. E.g. I am considering two objects same if their rollNo
is same so Student s1(10,"ABC",35)
and Student s2(10,"XYZ",67)
both are same. So when I say students.insert(s1)
and students.insert(s2)
, set will have only one object i.e. s1
.