A Link for Double Precision Numbers

To use the list class, a programmer must create a new type of link. Here we imagine that the programmer wants to keep a linked list of double precision numbers. The class DoubleLink is created which inherits from class Link, and which will hold a double precision value.

A minor fact to note is that the argument type in the equality test operator must match the type signature in the parent class. Thus, the argument can only be written as a Link value, and not a double link value. It must then be cast to the correct type inside the body of the operator.

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