
Prelab Activities
Review
Generic Data Types
A generic data type is a data type for which the operations are defined but the types of
the items being manipulated are not. Some programming languages have a built-in
mechanism for defining generic data types; some do not. C++ does. This mechanism is
called a template. A template allows you to write a description of a class type with
“blanks” left in the description to be filled in by the client code. Just as variables are
the parameters to functions, so types are the parameters to templates.
In the List class in Chapter 13, we defined the item on the list to be of type
ItemType and used a typedef statement ...