Introduction to OOP Chapter 17: The Polymorphic Variable : next previous audio real text

Another Example of Pure Polymorphism

This example is from Smalltalk.
between: low and: high
	^ (low <= self) and: [ self <= high]
Different arguments will implement the relational test differently, so different effects can be achieved.
x between: $a and: $z

x between: 1 and: 100

x between: 3.14 and: 4.56

x between: "abc" and: "pdq"

x between: 10@5 and:  50@40

Intro OOP, Chapter 17, Slide 09