![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Chapter 49: | How To Reuse Class Definitions Using Templates |
In Chapter 47 and Chapter 48, you learned how to use the
header
and link
classes to make a list of railroad cars.
The work was difficult, however, so you learn, in this chapter, how
to package what you have done for reuse by exploiting C++'s template
mechanism. Once you have defined template classes for lists, it is
easy to create new lists, and you can forget about all the detail you
have to struggle through to understand lists and templates.
Note, however, that the definition of template classes is merely illustrated with the use of lists. The template mechanism is a general feature of C++ with wide applicability.