下列函数模板的定义中,合法的是( )。

admin2020-06-29  32

问题 下列函数模板的定义中,合法的是(    )。

选项 A、templateT abs(T x){return x<0?-x:x;}
B、template classT abs(T x){return x<0.9-x:x;}
C、template Tabs(T x){return x<0.9-x:x;}
D、template T abs(T x){return x<0.9-x:x;}

答案A

解析 本题考查模板函数的基本概念,根据模板函数的定义,所以答案为A。
转载请注明原文地址:https://jikaoti.com/ti/jsA0FFFM
0

最新回复(0)