题目内容

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

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;}

查看答案
更多问题

在语句cin>>data;中,cin是

A. C++的关键字
B. 类名
C. 对象名
D. 函数名

下列关于类定义的说法中,正确的是

A. 类定义中包括数据成员和函数成员的声明
B. 类成员的缺省访问权限是保护的
C. 数据成员必须被声明为私有的
D. 成员函数只能在类体外进行定义

A.expectationB.desireC.hopeD.seek

A. expectation
B. desire
C. hope
D. seek

有如下程序段int i=0,j=1;int &r=i; //①r=j; //②int*p=&i; //③*p=&r; //④其中会产生编译错误的语句是

A. ④
B. ③
C. ②
D. ①

答案查题题库