|
- Queue is a generic class, that is
we can have a Queue of ints, a Queue of chars, a Queue of strings, and so on.
Queue is parameterised on its element type which can be instantiated to
int, char, string (*char) or to any other type.
-
-
-
- To make a Queue of int class use
‘Queue<int> variablename’
and similarly for any other element type.
- Queue is defined by a template;
think of it as a compile-time function with the
< > syntax around its parameter(s) to
distinguish it from a regular run-time function.
The Queue operations enQ & deQ
also depend on the element type, and are generic functions, and
their bodies are defined by templates.
|
|