In the following function template, what must be true in order to use the function with a given data type?
Template <class T>
Int smallest T array[], int size)
{
Int small=0, i;
Fori=0;i<size;i++)
{
Ifarray[i] < array[small])
Small=i;
}
Return small;
}
A) the data type must be a pre-defined data type
B) the data type must have a < operator defined for it
C) the data type must be numeric
D) the data type must be character based
Correct Answer:
Verified
Q17: Given the following template function definition, which
Q18: Given a class template named listClass, declare
Q19: All classes should be converted to templates
Q20: Using template functions is an example of
Q21: Which of the following is a correct
Q23: Given that you have two versions of
Q24: When would you want to make a
Q25: Given the following function template, which of
Q26: Using templates in your program where warranted,
Q27: Given a search template function that will
Unlock this Answer For Free Now!
View this answer and more for free by performing one of the following actions
Scan the QR code to install the App and get 2 free unlocks
Unlock quizzes for free by uploading documents