Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
C++ supports yet another method to reuse class design. This tool is called a template class. Instead of the class with a fixed type of component, you create the class where the type of component is treated as a class parameter.
This parameter has a programmer-defined name, for example, Type, T, Tp, and so on. (As for any parameter, it is up to the programmer to decide what to call it.) Its actual value can be any type, built-in or programmer-defined. As for any parameter, its actual value cannot be known at the time of compiling the template definition. When the client code instantiates an object of this class, it specifies the actual type that should be used in the class instead of the class parameter.