首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
以下程序的执行结果是__________。 #include #include class Sample { public: intx,y; Sample(){x=y=0;} Sample(i
以下程序的执行结果是__________。 #include #include class Sample { public: intx,y; Sample(){x=y=0;} Sample(i
admin
2012-12-29
61
问题
以下程序的执行结果是__________。
#include
#include
class Sample
{
public:
intx,y;
Sample(){x=y=0;}
Sample(int a,int b){x=a;y=b;}
void disp()
{
cout<<“x=”<
}
};
void main()
{
Sample s1(2,3);
s1.disp();
选项
答案
x=2,y=3
解析
此题考查的是构造函数重载。语句Sample s1(2,3)调用的类的构造爵数应该是含有两个参数的sample(int a,int b){x=a;y=b;}函数,所以输出的结果是x=2,y=3。
转载请注明原文地址:https://kaotiyun.com/show/yMVp777K
本试题收录于:
二级C题库NCRE全国计算机二级分类
0
二级C
NCRE全国计算机二级
相关试题推荐
数据库系统中完成查询操作使用的语言是()。
若变量已正确定义并赋初值,以下合法的赋值语句是()。
以下正确的字符串常量是()。
下列定义变量的语句中错误的是()。
以下叙述中错误的是()。
有如下程序 #include<stdio.h> #include<string.h> main() { chara[]="THIS\0",*b="OK\0\0"; printf("%d,%d,%d,%d",strlen(a),
有以下程序 #include<stdio.h> voidfun(doublex,double*y,double*z) {*y=*y-1.0;*z=*z+x;} main() {doublea=2.5,b=9.0,*pa,*pb;
有以下程序段 charc1,c2; for(c1=’0’,c2=’9’;c1<c2;c1++,c2--) printf("%c%c",c1,c2); 程序段的执行结果是()。
在数据库系统中,数据模型包括概念模型、逻辑模型和()。
以下选项中不能用作C程序合法常量的是()。
随机试题
中国书画史上把诗与画结合在一起的第一人是()。[江苏2019]
带有一个头结点的单链表head为空的条件是______。
Studentsshouldbeallowedtostudywithoutworryingaboutgrades.Fortunately,mosteducatorsarebecomingawareofthefactth
下列各项,不属肺炎链球菌肺炎病理改变分期叙述的是
某工程项目实施过程的部分时间参数如下表所示:其中,总时差最大的活动是()。
工程开工后,承包人应按照( )确认的进度计划组织施工。
下列各项不属于强制检定特点的是()。
Whydoesavegetarianrestaurantmakeitsdishesresemblemeatineverywayexcept______?
34.WhichisLucy’sbag,theyellowone______theredone?
I’mpleasedtotellyouthatthefaxmachinesyouorderedare______now.
最新回复
(
0
)