template<classT>//模板函数
T abc1(T a, T b, T c){
return a + b * c;}template<classT>//引用参数
T abc2(T &a, T &b, T &c){
return a + b * c;}template<classT1,classT2,classT3>//常量引用参数
T1 abc(const T1 &a,const T2 &b,const T3 &c){
return a + b * c;}
intabc4(int a,int b,int c){
if(a <=0|| b <=0|| c <=0)throw"All parameters should be > 0";//抛出异常return a + b * c;}intmain(){
try{
cout <<abc4(2,0,4)<< endl;}catch(char*e){
//捕捉char*类型异常
cout << e << endl;return1;}return0;}