单选题
C++
2017-03-30
下列函数模板的定义中,合法的是( )。
A.template<typenameT>T abs(T x){return x<0?-x:x;}
B.template class<T>T abs(T x){return x<0?-x:x;}
C.template T<class T>abs(T x){return x<0?-x:x;}
D.template T abs(T x){return x<O?-X:x;}
参考答案
A
答案解析
本题考查模板函数的基本概念,根据模板函数的定义,所以答案为A: