Figure 7.3 Comparison Defined as a Member Function
class box {public: box (int v) : value(v) { }
// define meaning of comparison for boxes
bool operator < (box & right) { return value < right.value; }
private: int value;
};
Previous slide
Next slide
Back to first slide
View graphic version