选择题
35.
下列函数模板的定义中,合法的是______。
A、
template<typename T>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<0? -x: x;}
【正确答案】
A
【答案解析】
本题考查模板函数的基本概念,根据模板函数的定义,所以答案为A。
提交答案
关闭