首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有如下程序: #include<iostream> using namespace std; class AA { int n; public: AA(int k);n(k){}
有如下程序: #include<iostream> using namespace std; class AA { int n; public: AA(int k);n(k){}
admin
2017-10-17
22
问题
有如下程序: #include<iostream> using namespace std; class AA { int n; public: AA(int k);n(k){} intget(){return n;} int get()const{return n+1;} }; int main() { AA a(5); const AA b(6); cout<<a.get()<<b.get(); return 0; } 执行后的输出结果是
选项
A、55
B、57
C、75
D、77
答案
B
解析
本题考查const对象。一个const对象只允许被声明为const的方法函数引用。
转载请注明原文地址:https://kaotiyun.com/show/mXAp777K
本试题收录于:
二级C题库NCRE全国计算机二级分类
0
二级C
NCRE全国计算机二级
相关试题推荐
下面程序执行的结果是【 】。#include<iostream>usingnamespacestd;voidmain(){intsum=0;intarray[6]={1,2,3,4,5,6
所有在函数中定义的变量及函数的形式参数,都属于
设a和b均为double型变量,且a=5.5、b=2.5,则表达式(int)a+ b/b的值是
C++语言中函数返回值的类型决定于
按“先进先出”原则组织数据的结构是
下面对静态数据成员的描述中,正确的是
完成下列类的构造函数,初始化语句为【 】。#include<iostream.h>classTest{private:intx,y;public,voidTest(intinitx,intinity){_
假定一个一维数组的定义为"chara[8],b;"若把该数组最后一个元素赋值给b,应该采取的表达式为:______。
有如下程序:#include<iostream>usingnamespacestd;Classx{protected:inta;public:x(){
有如下类的定义。那么空格处的语句是()。classMyClass{____________intx,y;public:MyClass(intx1=0,inty1=0){
随机试题
A、Haveadoctortreatthefracture.B、Haveadoctorplayaroundwith.C、Seeadoctorandhaveeyesexamined.D、Haveadoctorrea
A.201B.30C.100D.39.5E.40瑞典Elektaγ-刀装置使用______个60钴源
国内咯血的最常见病因是
足三阴经从起始部至内踝上8寸段的分布是()
财政分配的目的首先是(),同时也包括执行某些社会职能的需要,可统称为社会公共需要。
AlthoughJackisanEnglish,hecanspeak______fluently.
某市级人大代表在选举省级人大代表时,应选代表10人。根据我国选举法的规定,正式候选人人数可以为()
为计算1+2+22+23+24+…+210的值,并把结果显示在文本框Text1中,若编写如下事件过程:PrivateSubCommand1Click() Dima&,s&,k& s=1 a=2 Fork=2To10
数据库系统的三级模式分别【】模式、内部级模式与外部级模式。
DogsMakeEmployeesMoreProductiveAtWorkLeibLurieneverintendedforhiscompany,messagedeliveryserviceOneCallNow
最新回复
(
0
)