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