
708 Generic Programming with Templates
17.10 Write a program to overload a template function.
#include<iostream.h>
#include<conio.h>
template <class A>
void show(A c)
{
cout<<“\n Template variable c=”<<c;
}
void show (int f)
{
cout<<“\n Integer variable f=”<<f;
}
Explanation: In the above program, a template with A, B, and C classes are declared. The func-
tion show() has three arguments of type A, B, and C respectively. In main(), the function
show() is invoked, and three values of different data types are passed. The function show()
displays the values on the screen.
17.8 OVERLOADING OF TEMPLATE FUNCTIONS
A template function also supports the ov