OOP6 Polymorphism Flashcards
What is function overloading?
The use of the same name for different functions, distinguished by their parameter lists
What is a generic algorithm?
An algorithm where a series of steps or operations are defined but the data type of the items being manipulated are not.
What is operator overloading?
Allows to redefine the standard C++ operators
What does typedef keyword do?
Defines a data type with a new user generated identifier
What is a generic data type?
A type for which the operations are defined but the data being manipulated is not
What is a class template?
A construct whereby the compiler may generate multiple versions of a class through parameterised data types
How to define a class template?
template <parameter>
Class Definition {};</parameter>
What is a template parameter?
A parameter that is used in the template definition
What is required type of a parameter template parameter?
class/typename
How to instantiate a new class from a template?
template<class>
class GList {…};
…
GList<int> intList;</int></class>
Newly instantiated classes from templates are called?
Generated classes, template classes
How can the relationship between a class template and template classes be defined?
A template class is a specialisation of the class template
What is a function template?
A construct that allows the compiler to generate multiple versions of a function according to allowing parameterised data types
How to define a function template?
template<class>
void GList<ItemType>::foo(ItemType i)
{…}</ItemType></class>
Template functions should use const reference parameters. Why?
Because they are much more efficient for memory