0

Hi Everybody

I am trying to create a template class here is the code I trying to just add and multiply 2 number. But I am not able to do so using template class.

```
class calc
{
public:
template <class T>
T multiply(T x, T y);
T add(T x, T y);
};
template <class T> T calc<T>::multiply(T x,T y)
{
return x*y;
}
template <class T> T calc<T>::add(T x, T y)
{
return x+y;
}
int main ()
{
calc <T> c1;
int i=5, j=6, k;
long x=40, y=20, z;
k=c1.multiply<int>(i,j);
z=c1.add<long>(x,y);
cout << k << endl;
cout << z << endl;
return 0;
}
```

Thank you in advance for any guidance