47
Here’s one last question for you to think about. Of course, the answer
is that there is very little difference between a bag of integers and a bag
of any other type.
Other Kinds of Bags
❐In this example, we have implemented a bag
containing integers.
❐But we could have had a bag of float
numbers, a bag of characters, a bag of
strings . . .
Suppose you wanted one of these other
bags. How much would you need to change
in the implementation ?
Section 3.1 gives a simple solution using
the C++ typedef statement.