2. State which of the following is True and which is False. If false, explain wh
ID: 3910253 • Letter: 2
Question
2. State which of the following is True and which is False. If false, explain why. i. The template parameters of a function-template definition are used to specify the types of the arguments to the function, to specify the return type of the function and to declare variables within the function. ii. Keywords typename and class as used with a template type parameter specifically mean "any user-defined class type." iii. The template parameters of a function-template definition are not limited to types introduced by class or typename, but can also include expressions of other types (e.g. built-in int type). iv. Template parameter names among template definitions must be unique. v. Each member-function definition outside a class template must begin with a template headerExplanation / Answer
2.
i. The template parameters of a function template definition are used to specify the types of the arguments to the function, to specify the return type of the function and to declare variables within the function - True, template parameters of a function template definition example is:
template <class myType>
myType FunctionName (myType a, myType b) {
return (a>b?a:b);
}
ii. Keywords typename and class as used with a template type parameter specifically mean any user defined class type. - False, Keywords typename and class as used with a template type parameter also allow for fundamental type parameter.
iii. The template parameters of a function template definition are not limited to types introduced by class or typename, but can also include expressions of other types - True, templates can have definitions such as:
template <class T, int N>
iv. Template parameter names among template definitions must be unique - False, They need not be unique.
v. Each member function definition outside a class template must begin with a template header - True
/Please Hit Like if you like my response/
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.