#include <iostream>
using namespace std;
class Adder
{
public:
template<class T1, class T2>
void add(T1 x, T2 y)
{
cout<<"Sum is: "<<(x+y)<<endl;
}
};
int main()
{
Adder a1;
a1.add(4, 2);
Adder a2;
a2.add(3, 4.7);
return 0;
}
Note: Need to be arranged in compiler after copied
OutPut:
Sum is: 6
Sum is: 7.7
Sum is: 7.7