A powerful tool for C++ programmers is “parameterized types” or templates. Templates are so useful that a library containing a number of routines using templates has been adopted into the definition of the C++ language.
Today, you will learn
• What a template is and how templates can be used
• How to create class templates
• How to create function templates
• What the Standard Template Library (STL) is and how to use some of the templates within it
At the end of Week 2, you saw how to build a
PartsList object and how to use it to create a
PartsCatalog. If you want to build on the
PartsList object to make a list of cats, you have a problem:
PartsList only knows about parts.
To solve this problem, you can ...