| < Day Day Up > |
|
In your own words explain what static polymorphism is and how it is achieved in C++ using function and class templates.
Static polymorphism happens at compile time when a parameterized function, structure or class is used to specify a new function or class type.
In your own words give a definition of a template.
A template is a generic specification of a function, structure, or class that can be used to create a specific function, structure, or class type.
How are function templates related to overloaded function?
Function templates can often be used in place of function overloading because one generic function can be declared and defined to work on multiple parameter data types.
How are places reserved in source code for type substitution?
By using type placeholders.
How many type placeholders can a function or class template declare?
As many as are required.
If the number of type placeholders declared in a function template is greater than the number of function parameters, how can the type of extra placeholders be specified when the function is called?
Using the template specialization syntax.
Why is it a good idea to group the declaration and definition of a class or function template in one header file?
To ensure compatibility.
Is it necessary to group the declaration and definition of a class or function template in one header file?
It depends on the compiler.
What is the purpose of an STL container adapter?
STL container adapters use STL containers to implement their functionality.
What are iterators and how are they related to pointers? What is the purpose of an iterator? What benefits do you gain from using iterators to manipulate container elements vs. other iterative methods.
Iterators provide a uniform way to manipulate elements in a container component regardless of the container type.
| < Day Day Up > |
|