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