In the c++ object oriented by joyce farrell 4th edition .
a Question called us to create Jobbid.cpp
which want
1.Data fields associated with the bid number and quoted price.
2.Overload the extraction and insertion operators. Don not use a constructor to set field values.
3.Define an overloaded operator < () function used to compare JobBid objects. One JobBid is considered lower than another if the quoted price is lower.
I can't get what the book mean at all , just trying to learn about the overloaded operating ,
what I done so far
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
class Jobid {
public:
Jobid(int initBid, int intiQuote ) {
if (intBid < 0)
initBid *= -1; // make a negative bid positve
if (initQuote < 0)
initQoute *= -1; // same as above
bid = initBid; // store them
qoute = initQoute;
}
booloperator < (const Jobid& j) const { return qoute < j.qoute; }
int Bid() { return bid; }
int Qoute { return qoute; }
private:
int bid;
int qoute;
};
is it correct ? I saw some solutions provide by senior. but I don't know what should i continue of it