next up previous
Next: How do I specify Up: What are templates? Previous: How do I specify

How do I specify a class template?

In a header (.h file). The template parameter can be used for defining any member of the class.
template <class T, int N>
class   Vector
  T	array[N];
  void method(T t, int i) { array[i] = T; }

Alexis Angelidis (PhD) 2005-01-11