previous | start | next

1. C++ template functions and template classes

C++ lets you declare and use a special kind of variable whose value is a type name or expression

The syntax for declaring such a variable is:

        template <typename T>
     

This declares T to be a variable whose value can be a type name or expression.

An alternate syntax is often used:

        template <class T>        
     

but the value of T can be type expressions like int or Point or int *

That is, the value of T does not have to a type that is the name of a class.



previous | start | next