When we use a container to store objects from an inheritance hierarchy, we generally must store those objects indirectly. We cannot put objects of types related by inheritance directly into a container, because there is no way to define a container that holds elements of differing types.
As an example, assume we want to define a
vector to hold several books that a customer wants to buy. It should be easy to see that we can’t use a
vector that holds
Bulk_quote objects. We can’t convert
Quote objects to
Bulk_quote (§15.2.3, p. 602), so we wouldn’t be able to put
Quote objects into that
It may be somewhat ...