11. Templates
Overview
This chapter covers an overview of templates and gives some examples of how they can be used and where. By the end of this chapter, you will feel confident enough to implement template types and functions where they may be applicable and have some foundational knowledge you can build from.
Introduction
In the previous chapters, OOP was introduced, along with examples and use cases. Classes and best practices for creating them were covered in detail. In this chapter, we are going to look at another powerful feature of OOP—templates.
Templates allow the reuse of code for different data types. An example of the use of templates is the C++ standard template library (or STL). This library is a set of template classes ...
Get The C++ Workshop now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.