Chapter 13: Working with Templates

This chapter will continue our pursuit of increasing your C++ programming repertoire beyond OOP concepts, with the continued goal of writing more extensible code. We will next explore creating generic code using C++ templates – both template functions and template classes. We will learn how template code, when written correctly, is the pinnacle of code reuse. We will explore how to create both template functions and template classes, as well as understanding the how appropriate use of operator overloading can make a template function reusable for nearly any type of data.

In this chapter, we will cover the following main topics:

  • Exploring template basics to genericize code
  • Understanding how to create and use ...

Get Demystified Object-Oriented Programming with C++ now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.