Template Example 4 – C++ Language

#include <iostream>

using namespace std;
template<class T, class M, class Q>
class test
{
public:
sum(T a, M b)
{
cout<<a+b<<endl;
}
summ(M c, Q d)
{
cout<<c+d<<endl;
}
void func()
{
cout<<“Hello”<<endl;
}
};
int main()
{
try
{
throw ‘S’;
}
catch(char c)
{
cout<<c<<endl;
}
test<int, float, double> obj;
obj.sum(5,2.2);
obj.summ(5,3);
return 0;
}