Define template function for class type
#include <iostream>
using namespace std;
template <class type1, class type2>
void myFunction(type1 x, type2 y)
{
cout << x << ' ' << y << '\n';
}
int main()
{
myFunction(10, "hi");
myFunction(0.23, 10L);
return 0;
}
Related examples in the same category