ntemplate <class
TYPE, int sz>
nclass stack {
n public:
n stack();
n int push(const TYPE & data);
n TYPE & pop();
n private:
n //this does not instantiated the list
class
n list <int, 100, stack>
list_object;
n };
n
ntemplate <class
TYPE, int sz>
nint
stack<TYPE,sz>::push(const TYPE & data) {
n //if this is the first usage of the
list_object member,
n //then the list class is instantiated
n list_object <<data;
n ...
n
n