Overridden Methods

What saves us is the replacement semantics of Smalltalk. Child classes override the less than operator, and only this one operator, and give it a variety of different meanings. The other comparison operators are the defined automatically for free.

The less than operator is defined with a number of different meansings. For example, numbers have the obvious number line ordering. Characters use the ascii sequence. Strings redefine less than to mean dictionary ordering. Other collections use the subset relationship to define an ordering. Points override the meaning to mean lower and to the left. The latter two are interesting because they provide only a partial ordering, not a total ordering on all values.

[audio] [real] Text to accompany slide13, in Chapter 14 of An Introduction to Object-Oriented Programming