•And, the class template must be declared prior to explicitly instantiating such a class.
n//class template
declaration
ntemplate <class
TYPE, int sz> class stack;
n
ntemplate class
stack<int,100>; //explicit
instantiation
n
•When we use a class identifier as the second operand of the direct or indirect member access operators
(the . and ->
operators) or after the scope resolution operator, we must precede the class' identifier with the keyword template.
nlist_object->template
node<int> * ptr = new node<int>;
n
n//the following is
illegal if node is a class template
nlist_object->node<int>
* ptr = new node<int>;
n