175. Template

Question.1

A developer writes a generic swap function:

template<typename T>
void swap_val(T& a, T& b) {
   T temp = a; a = b; b = temp;
}

int x=10, y=20;
swap_val(x, y);
float f1=1.5f, f2=4.5f;
swap_val(f1, f2);

How many functions does the compiler generate?

Need Help? Refer to the Quick Guide below

Select Answer