# the superplane

It is a past contest problem :—
http://www.codechef.com/problems/SUPERPLN

I have understood the solution given in tutorial .But it is difficult to undertand the
bool operator >(class flight &a ){} function .why is it given and how it is working

Hello @vivek07672,

The function:

``````struct flight
{
int u0,t0,u1,t1;
flight(){}
flight(int u0_,int t0_){u0=u0_;t0=t0_;}
{
scanf("%d%d%d%d",&u0,&t0,&u1,&t1);
}
bool operator<(const flight &a) const
{
return u0<a.u0 || u0==a.u0 && t0<a.t0;
}
};
``````

is, as you can see, embedded inside the definition of the new data type flight.

Its only purpose is to “override” in some sense, the operator < (which we are more used to see working both with numbers, strings, etc.), so that it can compare flights according to some specific attribute they have… On this particular case, this comparison is done, by " (…) you can sort all flights by the city of arrival and then by the time of arrival (…)" and if you see it carefully, that is exactly what it is specified on the comparison function:

Firstly, they are compared by city of arrival and if two planes arrive at the same city, their arrival time is used as a tie-breaker.

Hope I could help,

Bruno

okkk!!! so this function is totally for sort() function that is used in there …
or there is someconnection with lower_bound() stl function ??
also i am not getting the diclaration for lowerbound() function ??