Three Solutions

We will examine three different solutions to this problem, all in the context of C++. The first is having containers maintain elements derived from a common ancestor class. The second is to have containers that maintain pointers, which can be cast to the appropriate type. And the third alternative is to use templates. The template solution is nowdays taken to be the best alternative, at least in the C++ world.

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