1. Home
  2. Computing & Technology
  3. C / C++ / C#

Definition of Template

By , About.com Guide

Definition: A template is a C++ feature that allows functions and classes to be defined with any type.

With a non-templated function, the parameters to that function are declared to be of a particular type. By defining a template function, that function can be called with a compatible type and the compiler will use the type derived from the parameter.

With template classes such as the Vector class in the STL, it is possible to create a vector class (an array that can change size at runtime) of say payroll objects. Because of the strict typing, only payroll obejcts can be stored in the list.

Glossary:

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Explore C / C++ / C#
About.com Special Features

Holiday Central

What to eat, where to go, fun things to do and how to save money on the perfect gifts. More >

Family Tech Center

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

  1. Home
  2. Computing & Technology
  3. C / C++ / C#
  4. Glossary
  5. Template - Definition

©2009 About.com, a part of The New York Times Company.

All rights reserved.