why in the class bool operator() (person a, person b){}
what is the difference between that and bool operator(person a, person b){}
And what is the difference between that and bool (person a, person b){}
why in the class bool operator() (person a, person b){}
what is the difference between that and bool operator(person a, person b){}
And what is the difference between that and bool (person a, person b){}
bool operator() (person a, person b) {}
basically overloads the operator ()
and calls this functions.
You cannot have bool operator(person a, person b){}
because operator is a keyword so you cannot use it as a function name. If you had any other name like bool Operator(person a, person b){}
then this function would get called by calling “classname.Operator()” but the “overloaded” function gets called by the use of ()
I am sorry but i still didnt understand the answer, can you give more examples
@Souradeep-Kundu-824545687968212 please elaborate your query. What you are asking is not even possible, because operator is a keyword and you cannot use it as a function name.
what is overloaded operator and how is it used