18.2. Class Templates
It’s possible to understand the concept of a stack (a data structure into which we insert items only at the top and retrieve those items only from the top in last-in, first-out order) independent of the type of the items being placed in the stack. However, to instantiate a stack, a data type must be specified. This creates a nice opportunity for software reusability—as you already saw with the
stack container adapter in Section 15.7.1. Here, we define a stack generically then use type-specific versions of this generic stack class.
Software Engineering Observation 18.1
Class templates encourage software reusability by enabling ...