class templates and function templates code example
Example 1: template in c++
// template function
template <class T>
T Large(T n1, T n2)
{
return (n1 > n2) ? n1 : n2;
}
Example 2: how to write a template c++
template <class myType>
myType GetMax (myType a, myType b) {
return (a>b?a:b);
}