T
Tony Johansson
Hello Experts!
I reading a book called programming with design pattern revealed
by Tomasz Muldner and here I read something that I don't understand
completely.
It says:
"Type parameterization makes it possible to combine two representation.
For example, the class Stack<T> and the class List<T> can be combined in one
step to
create a stack of lists of type T:"
Stack<List<T> >
Now to my question
When we have the declaration with the template in the beginning of a class
definition in this way
template<class T>
what type is T when we have this expression Stack<List<T> > as above.
List<T> in not a type so how can it be possible to write a expression like
this Stack<List<T> > then
I do know if you write Stack<int> si; or Stack<Student> ss what it means.
Many thanks
//Tony
I reading a book called programming with design pattern revealed
by Tomasz Muldner and here I read something that I don't understand
completely.
It says:
"Type parameterization makes it possible to combine two representation.
For example, the class Stack<T> and the class List<T> can be combined in one
step to
create a stack of lists of type T:"
Stack<List<T> >
Now to my question
When we have the declaration with the template in the beginning of a class
definition in this way
template<class T>
what type is T when we have this expression Stack<List<T> > as above.
List<T> in not a type so how can it be possible to write a expression like
this Stack<List<T> > then
I do know if you write Stack<int> si; or Stack<Student> ss what it means.
Many thanks
//Tony