SUMMARY
  • Generic programming – A technique for defining classes or functions in terms of generic type. The compiler automatically substitutes code for a specified type.
  • Parameterized classes – Templates are sometimes called parameterized classes as templates are defined with a parameter that would be replaced by a specified data type.
  • Parameterized functions – Function templates are sometimes called parameterized functions.
  • We can have function templates as well as class templates.
  • Function template – A function is defined in terms of generalized class (type), say T. It produces many versions depending on the definition of T.
  • We can overload a function template for a particular type.
  • Class template – The class template is also called a generic ...

Get Object Oriented Programming with C++, Second Edition 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.