首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有如下程序: #include using namespace std; class A{ public: A(int i):r1(i){} void print(){cout
有如下程序: #include using namespace std; class A{ public: A(int i):r1(i){} void print(){cout
admin
2019-03-05
53
问题
有如下程序:
#include
using namespace std;
class A{
public:
A(int i):r1(i){}
void print(){cout<<’E’<
void print()const{cout<<’C’<
private:
int r1;
};
int main(){
A a1(2); const A a2(4);
a1.print();a2.print();
return 0;
}
运行时的输出结果是( )。
选项
A、运行时出错
B、E2-C16-
C、C4-C16-
D、E2-E4-
答案
B
解析
const关键字可以用于参与对重载函数的区分。重载的原则是常对象调用常成员函数,一般对象调用一般成员函数。
转载请注明原文地址:https://www.kaotiyun.com/show/DqAp777K
本试题收录于:
二级C题库NCRE全国计算机二级分类
0
二级C
NCRE全国计算机二级
相关试题推荐
以下不属于构造函数特征的是
若有以下定义:inta[]={1,2,3,4,5,6,7);charc1=’b’,c2=’2’;则数值不为2的表达式是
函数定义的格式是______函数名(形式参数表)函数体。
有以下程序:voidfun(inta*a,inti,inti){intt;if(i<j);{t=a[i];a[i]=a[j];a[j]=t;fun(a,++i,--j);}}main
假定MyClass为一个类,则执行MyClassab(2),*p;语句时,自动调用该类构造函数()次。
在关系数据库中,把数据表示成二维表,每一个二维表称为______。
有如下类定义:classTest{public:Test(){a=0;C=0;t//①intf(intA)const{this->a=a;}//②staticintg(){retur
有如下程序:#include<iostream>usingnamespacestd;usingnamespacestd;classBase{public:voidfun(){cout<<"Ba
数据库设计的4个阶段是:需求分析、概念设计、逻辑设计和
如下程序定义了“单词”类word,类中重载了<运算符,用于比较“单词”的大小,返回相应的逻辑值。程序的输出结果为:AfterSorting:HappyWelcome,请将程序补充完整。#include<iostream>#inclu
随机试题
A.右侧肷部前切口B.右侧肷部中切口C.右侧肷部后切口D.右侧肋骨弓下斜切口E.腹中线切口牛空肠切开术的切口位置是
背景某安装公司承接一新建供暖厂的建设合同,其中设备安装包括4台引风机、8台鼓风机、2台20t桥式起重机、26台水泵、4台胶带输机、10台螺旋输机、2台斗式提升机、2台振动筛。引风机经过就位、地脚螺栓灌浆、初找、精找等工序,最先达到单机试
根据我国现行《土地增值税暂行条例》的规定,纳税人应于()申报缴纳土地增值税。
Theunderseaworldisverybeautiful.Nowmoreandmorepeoplewanttodiveinthewatertofindthesecretsthere.Scubadiving
A类网络是很大的网络,每个A类网络中可以有(66)个网络地址。实际使用中必须把A类网络划分为子网,如果指定的子网掩码为255.255.192.0,则该网络被划分为(67)个子网。(66)
世界的な洪水の多発は熱帯雨林がげんしょうし森林のもっている環境ほぜん能力がうしなわれたことにも原因がある。森林
EveryyearNewZealanderslivinginLondoncanbeseenloadingupKombivansandheadingofftoexperiencethe"classicEuropean
Completethetablebelow.WriteNOMORETHANTWOWORDSAND/ORANUMBERforeachanswer.
Sofar,inflationisroaringinonlyafewsectorsoftheeconomy.Whileplatinumhassoared121percent,soybeanshaverisen11
Themillionsofinternallydisplacedpersonsfacethesamefateasthatofrefugees.UnitedNationsHighCommissionerforRefug
最新回复
(
0
)