T
Tony Johansson
Hello Experts!
Assume I have one function that is a template function called add and one
concrete function that also have the name add is it any point to make a
concrete function add in this example?
template <typename T>
T add(T rh, T lh)
{ return rh+lh; }
template <typename T>
int add(int rh, int lh)
{ return rh+lh; }
int main()
{
int i=1, j=2;
cout << "result " << add<int>(i,j) << endl;
return 0;
}
//Many thanks
//Tony
Assume I have one function that is a template function called add and one
concrete function that also have the name add is it any point to make a
concrete function add in this example?
template <typename T>
T add(T rh, T lh)
{ return rh+lh; }
template <typename T>
int add(int rh, int lh)
{ return rh+lh; }
int main()
{
int i=1, j=2;
cout << "result " << add<int>(i,j) << endl;
return 0;
}
//Many thanks
//Tony