Computer Science - Object Oriented Programming Using C++ - Discussion
Discussion Forum : Object Oriented Programming Using C++ - Section 8 (Q.No. 12)
12.
A function that uses variable types is called __________
Discussion:
1 comments Page 1 of 1.
Ayesha... said:
5 years ago
A function that uses variable types is called A function that uses variable types is called
a template function.
template <template-parameters> function-declaration
The template parameters are a series of parameters separated by commas. These parameters can be generic template types by specifying either the class or typename keyword followed by an identifier. This identifier can then be used in the function declaration as if it was a regular type. For example, a generic sum function could be defined as:
template <class SomeType>
SomeType sum (SomeType a, SomeType b)
{
return a+b;
}.
template <template-parameters> function-declaration.
The template parameters are a series of parameters separated by commas. These parameters can be generic template types by specifying either the class or typename keyword followed by an identifier. This identifier can then be used in the function declaration as if it was a regular type.
For example, a generic sum function could be defined as:
template <class SomeType>
SomeType sum (SomeType a, SomeType b)
{
return a+b;
}
a template function.
template <template-parameters> function-declaration
The template parameters are a series of parameters separated by commas. These parameters can be generic template types by specifying either the class or typename keyword followed by an identifier. This identifier can then be used in the function declaration as if it was a regular type. For example, a generic sum function could be defined as:
template <class SomeType>
SomeType sum (SomeType a, SomeType b)
{
return a+b;
}.
template <template-parameters> function-declaration.
The template parameters are a series of parameters separated by commas. These parameters can be generic template types by specifying either the class or typename keyword followed by an identifier. This identifier can then be used in the function declaration as if it was a regular type.
For example, a generic sum function could be defined as:
template <class SomeType>
SomeType sum (SomeType a, SomeType b)
{
return a+b;
}
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers