#include<iostream>
using namespace std
;
template<class T1, typename T2
>
inline T1
add(T1 x
, T2 y
)
{
return x
+y
;
}
template<>
int add
<int, char>(int x
, char y
)
{
return x
+ y
;
}
void main()
{
cout
<< add(10, 20) << endl
;
cout
<< add
<double, double>(10.5, 20.3) << endl
;
cout
<< add(10, 'W') << endl
;
}
转载请注明原文地址: https://www.6miu.com/read-37595.html