In comparator class PersonComp{
public:
bool operator( )(Person p1, Person p2){
return p1.age < p2.age;
}
}
Why we are overloading the ( ) operator?
In comparator class PersonComp{
public:
bool operator( )(Person p1, Person p2){
return p1.age < p2.age;
}
}
Why we are overloading the ( ) operator?
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.
hello @a19JE0093
priority queue will use these overloaded operator to decide the ordering of elements.
and why we explicity overloading it ,and adding our own comparision logic.