Conventional Solution

The problem is perhaps best brought into focus by considering containers in a conventional language, such as Pascal. Here we have the declaration for a link in a linked list abstraction. But it is not simply a link, it is a link that holds an integer value. It can only hold an integer value. If my linked list must maintain double precision values I must create a new data type.

Thus, the problem in a conventional language is that the typing system is too tight. I cannot describe a linked list, without saying that it is a linked list of something. And, having said that, I cannot then use my class to hold elements of a different type.

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