| < Day Day Up > |
|
A template defines a related set of classes or functions. The related set of classes or functions defined by a template share the same code structure and functionality. The class or function template can then be used to declare a new class or function type.
A function template is a generic function declaration and definition from which different versions of the function can be created by the compiler based on the argument types used to call the function. If you think this sounds a lot like overloaded functions you are right. Function templates and overloaded functions are related as you will soon see.
A class template is a generic class declaration and definition from which different, but related, class types can be created by the compiler based on type parameters.
A structure template is like a class template but using structures instead.
| < Day Day Up > |
|