Containers that Hold Only Pointers

Because only pointers and references are polymorphic in C++, many applications end up making extensive use of pointers. If a container is only going to be used for pointer values, we can simplify things somewhat by creating containers that hold universal pointer values, called void-star pointers in C++.

We still need to cast back from the void start pointer type to the original type when we remove such a value from a container.

This is similar to the way that Java containers hold values in variables of type Object, which then must be cast back to the original type when they are removed from a collection.

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