Код:

template<class type>
type test(type a, type b)
{
return a + b;
}
int main()
{
cout << test(10, 20);
cout << test(10.5, 20.2);
}
template<class type1>
class test
{
public:
test() {}
type1 plus(type1 a, type1 b)
{
return a + b;
}
type1 minus(type1 a, type1 1);
};
template<class type1>
type1 test<type1>::minus(type1 a, type1 b)
{
return a - b;
}
int main()
{
test<double> t1;
test<int> t2;
t1.plus(10.1,10.2);
t2.minus(1, 2);
}