I have a template class with an overloaded + operator. This is working fine when I am adding two ints or two doubles. How do I get it to add and int and a double and return th
You can add int and double values by using templates.In the function, specify 2 arguments and while passing values to the functions specify its types in angular brackets.
example:
//template
template
void add(T1 a, T2 b)
{
//for adding values
cout<<"\n\nSum : "<(4,5.5454);
add(4.7,5);
add("hi","bye");
return 0;
}