首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有如下程序: #include<iostream> using namespaee std; class A{ public: A(int i):rl(i){ } void print( ){cout<<’E’<<rl<
有如下程序: #include<iostream> using namespaee std; class A{ public: A(int i):rl(i){ } void print( ){cout<<’E’<<rl<
admin
2013-02-27
66
问题
有如下程序: #include<iostream> using namespaee std; class A{ public: A(int i):rl(i){ } void print( ){cout<<’E’<<rl<<’-’;} void print( )const}cout<<’C’<<rl*rl<<’-’;} private: int rl; }; int main( ){ A al(2);eonst A a2(4); a1.print( );a2.print( ); return 0; } 程序的输出结果是
选项
A、运行时出错
B、E2-C16-
C、C4-C16-
D、E2-E4-
答案
B
解析
在类中重载函数的情况下,常对象调用类的常成员函数,非常对象调用类的非常成员函数,故答案为B。
转载请注明原文地址:https://www.kaotiyun.com/show/vSVp777K
本试题收录于:
二级C题库NCRE全国计算机二级分类
0
二级C
NCRE全国计算机二级
相关试题推荐
若有语句typedefstruetS{intg;charh;}T;,则下列叙述中正确的是()。
若要使int型变量a,b,c,d的值都为0,以下写法中错误的是()。
有下列程序 #include<stdio.h> inta=1; intfunc(intD) {intb=1; staticintc=1: a++;b++;++c;++d; returna+b+c+d: }
有以下程序 #include<stdio.h> voidfun(char*a,charB) {while(*(a++)!=’\0’); while(*(a-1)<B)*(a--)=*(a-1); *(a--)=b;
若有定义:chars1[100]="name",s2[50]="address",s3[80]="person";,要将它们连接成新串:"personnameaddress",正确的函数调用语句是()。
设栈的顺序存储空间为S(1:m),初始状态为top=0。现经过一系列正常的入栈与退栈操作后,top=m+1,则栈中的元素个数为()。
若有定义chara,b;,则执行表达式a=3^2和b=~(5∣2∣0xf0)后,a,b的十进制值分别是()。
有以下程序 #include<stdio.h> main() { intch=020; printf("%d\n",ch=ch>>1); } 程序运行后的输出结果是()。
同一个关系模型的任意两个元组值()。
问题处理方案的正确而完整的描述称为【】。
随机试题
Thegovernmenthaslostagreatdealof______becauseofthelargeincreaseinfoodprice.
A.1.8~3.0mg/LB.50mg/LC.100mg/LD.500mg/LE.1000mg/L二氧化氯水初级处理需用的浓度应为
临床将丸剂变为汤剂运用时,可能引起的变化不包括
《药品生产质量管理法规》对机构与人员严格要求,下列关于关键人员的说法正确的是()。
根据《合同法》的规定,对格式条款合同的理解发生争议的,应当()。
PeanutstoThisProudlyreadingmywords,Iglancedaroundtheroom,onlytofindmyclassmatesbearingbigsmilesontheirf
设函数y=(x)由方程ln(x+y)=xy确定,求dy|x=0。
求幂级数的和函数.
Whatdoesthewomansuggestthatthemando?
A、Itisintellectuallychallenging.B、Itrequireshimtodowashing-upallthetime.C、Itexposeshimtooilysmokealldaylong
最新回复
(
0
)