首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
下列模板声明中,有语法错误的是( )。
下列模板声明中,有语法错误的是( )。
admin
2020-04-07
26
问题
下列模板声明中,有语法错误的是( )。
选项
A、template
T fun(T x){return x;}
B、template
T fun(T x,int n){return x*n;}
C、template
T fun(T*p){return*p;}
D、template
T classA{T n;};
答案
D
解析
第四个选项是定义类模板的,但是class前面的T是多余的。对于第二个选项,同一个类的对象相乘还是同一个类的对象,但是可能要考虑溢出的问题。
转载请注明原文地址:https://kaotiyun.com/show/jV8p777K
本试题收录于:
二级C题库NCRE全国计算机二级分类
0
二级C
NCRE全国计算机二级
相关试题推荐
构造函数是和【】同名的函数。
下面程序的运行结果为#include<iostream.h>classA{public:A(){cout<<"1";}~A(){cout<<"2";}};c
BaseDerived创建Derived类型的对象将导致Derived的构造函数被执行,而执行Derived构造函数时,首先要执行其父类的构造函数,所以先输出”Base”,然后输出”Derived”;p是一个指向.Base类型的指针,对其赋值不会引起构造函
执行语句序列intx=10,&r=X;cout<<x<<’-’,<<r<<endl;输出结果为【】。
若有语句int*point,a=4;和point=&a;下面均代表地址的一组选项是
函数f()的功能是将形参x的值转换为二进制数,所得二进制数的每一位数放在一维数组y中返回。二进制的最低位放在下标为0的元素中,请将程序补充完整。voidf(intx,inty[]){intm=0,n;do{
面向对象程序设计思想的主要特征中不包括
以下选项中合法的实型常数是
在函数定义前加上关键字“inline”,表示该函数被定义为()。
分析以下程序的执行结果______________。#includeclassSample{intx,y;public:Sample(){x=y=0;}Sample(inta,
随机试题
A.浦肯野纤维B.房室交界C.心室肌细胞D.窦房结细胞自动节律性最高的是
(2006)由元件的饱和引起的控制系统的非线性静态特性为()。
某企业总承包的某公寓楼工程的投标文件中,土建工程的分部分项工程量清单计价合价为11810814.96元,措施项目清单计价合价为710609.49元,其他项目清单计价合价为223212.33元,规费费率为清单价的6%,税率为不含税造价的3.41%。有部分任务
1.背景某建筑公司(乙方)与某学校(甲方)签订了教学楼承建合同,合同约定工期奖罚条件:乙方提前完成该工程1周,甲方奖励乙方10万元,若乙方延误总工期1周,则扣除乙方工程款10万元。合同中约定:施工中实际工程量超过计划工程量10%以上时,超出部分按单价的
抗日战争时期,毛泽东提出的著名论断是()。
实践对认识的决定作用表现在实践是()。
国家教育部与各省、自治区、直辖市的教育厅之间属于()。
设某单位路由器建立了以下的路由表,若收到分组的目的IP地址为128.96.37.151,则转发的口是(57),若收到分组的目的IP是128.96.35.151,则转发的端口是(58),若该路由器是该单位的与Internet接人路由器,则该单位分得的IP地址
A、 B、 C、 B[A]是plane,[B]是tank,[C]是jeep。
A、Ahandwrittenone.B、Onethatisrevisedbythestudent.C、Onethatisoriginative.D、Onethatconformstotheinstructions.D
最新回复
(
0
)