First page Back Continue Last page Graphics
Class Template cont.
Implicit Instantiation.
- ArrayTb<int, 100> stuff; // note no “template”
Explicit Instantiation.
- template class ArrayTb<String, 100>
Explicit Specialization.
- template <class T> // non specialized
- class SortedArray
- { ... };
- template <> class SortedArray<char *>
- // specialized. Forces strcmp to be used instead of > to compare array values.
- SortedArray<int> scores; // use general defn
- SortedArray<char *> dates; // use specialized defn