Hi all,
I want to use a greater than operator and overload it to compare two objects of the same class thereby doing a bubble or selection sort to alphabetize...
I understand the syntax (I think) I have it sans the overlaod my question it the delaration of this operator..
should it be a friend or a member function and what it is's setup?
the alphabetize function I use is as follow:
it seems there is not alot of info about thhis operator overload..there are tons of things about insertion and extraction and mathematical..Code://Seat::& operator < (const Seat *seat_o ) //the above doesn't fly.... //alphabetize:client function void Airplane::alpha () //in: *s[], Mnum; out:none { char Ln[20]={""}; char Ln1[20]={""}; char Fn[20]={""}; Seat *tempname; for (int i = 0; i < MAX_ITEMS; i++) { for (int j = i+1; j < MAX_ITEMS; j++) { seats[i]->getLastname(Ln1); seats[j]->getLastname(Ln); if ((Ln1[0] > Ln[0])) { tempname = seats[i]; seats[i] = seats[j]; seats[j] = tempname; }//if }//for }// printalpha();
any help MUCH appreciated as always..
thanks from
the bouncing Mouse