首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有以下程序:#include <iostream>using namespace std;class sample{private: int x; static int y;public: sample(int a); static voi
有以下程序:#include <iostream>using namespace std;class sample{private: int x; static int y;public: sample(int a); static voi
admin
2009-01-15
71
问题
有以下程序:#include <iostream>using namespace std;class sample{private: int x; static int y;public: sample(int a); static void print(sample s);};sample:: sample(int a){ x=a; y+=x;}void sample:: print(sample s){ cout<<"x="<<s. x<<",y="<<y<<end1;}int sample:: y=0;int main(){ sample s1(10); sample s2(20); sample:: print(s2); return 0;}程序运行后的输出结果是( )。
选项
A、x=10,y=20
B、x=20,y=30
C、x=30,y=20
D、x=30,y=30
答案
2
解析
转载请注明原文地址:https://www.kaotiyun.com/show/L5kp777K
本试题收录于:
二级C题库NCRE全国计算机二级分类
0
二级C
NCRE全国计算机二级
相关试题推荐
下列程序中函数f的功能是:当flag为1时,进行由小到大排序;当flag为0时,进行由大到小排序voidf(intb[],intn,intflag){inti,i,t;for(i=0;i<n-1;i++)for(j=i+1;j<n;j++
以下选项中合法的实型常量是
下列叙述中正确的是
设已有定义:floatx;则以下对指针变量P进行定义且赋初值的语句中正确的是
下列关于线性链表的叙述中,正确的是
以下函数按每行8个输出数组中的数据:voidfun(int*w,intn){inti;for(i=0;i
读取二进制文件的函数调用形式为:fread(buffer,size,count,fp);,其中buffer代表的是()。
下面选项中合法的字符常量是
设有以下函数:voidfun(intn,char*s){…},则下列对函数指针的定义和赋值均正确的是()。
随机试题
LaughterThenatureoflaughterlaughterisa【L31】________process—involvesmovementandsounditiscontrolledbyour【
下图所示两根梁C截面的弯矩影响线相同。()
A.HPLC法B.硼酸亲和柱层析法C.电泳法D.阳离子交换柱层析法E.免疫浊度法测定糖化血红蛋白时可用于自动生化分析仪的方法是
我国航空意外险每份保单的保险金额为()万元,投保人最多可以买()份。
下列关于增值税专用发票填开时间的规定,正确的有()。
你是后勤保障部食堂管理人员,单位有个同事反映食堂饭菜不新鲜、鱼肉变质,其他同事也纷纷在微信群反映同样的问题。此时,你会怎么做?
"Cool"isawordwithmanymeanings.Itstraditionalmeaningisusedto【C1】______atemperaturethatisfairlycool.Astheworld
Whatisbeingadvertised?
SalesWhenastoresells【T1】______atacostlowerthanusual,itiscalledasale.Saleslastfor【T2】______.Thenthecosti
A、Thewomanwillreservearestaurantforthedinner.B、MaryKingwilldecidewheretheyhavetheirdinner.C、Themanwilldecid
最新回复
(
0
)