C++ provides language support not only for object-oriented programming, but also for generic programming. The goal of generic programming is to write reusable code.The fundamental tools for generic programming in C++ are templates. This chapter starts with a discussion on using templates for generic programming. It then describes the syntax on how to write templates and examples where templates are really useful. It explains how to write class templates, how to organize the code in different files, how to use template parameters, and how to templatize methods of a class. It further discusses how to use class template specialization to write special implementations of a template where the template parameters are replaced with specific arguments. In order to understand class templates, it is helpful to examine the syntax. The chapter finishes with an explanation of function templates and variable templates.