首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有如下程序: #include<iostream> using namespace std; class Test{ public: Test() {n+=2;} ~Test() {n-=3;}
有如下程序: #include<iostream> using namespace std; class Test{ public: Test() {n+=2;} ~Test() {n-=3;}
admin
2009-01-15
18
问题
有如下程序: #include<iostream> using namespace std; class Test{ public: Test() {n+=2;} ~Test() {n-=3;} static int getNum(){return n;} private: static int n; }; int Test::n=1; int main() { Test* p=new Test; delete p; cout<<"n="<<Test::getNum()<<endl; return0; } 执行后的输出结果是( )。
选项
A、n=0
B、n=1
C、n=2
D、n=3
答案
1
解析
转载请注明原文地址:https://kaotiyun.com/show/zlkp777K
本试题收录于:
二级C题库NCRE全国计算机二级分类
0
二级C
NCRE全国计算机二级
相关试题推荐
有以下程序main(){chara[5][10]={"one","two","three","four","five");inti,j;Chart;for(i=0;i
有以下程序:#includevoidmain(){chara,b,C,d;scanf(“%c%c”,&a,&b);c=getchar();d=getchar();prinff(“%c%
有以下程序#includemain(){inta=2,b;b=a<<2;printf("%d\n",b);}程序运行后的输出结果是
以下选项中叙述正确的是()。
使用VC++2010打开考生文件夹下prog1中的解决方案。此解决方案的项目中包含一个源程序文件prog1.c。在此程序中,请编写函数fun,其功能是:将放在字符串数组中的M个字符串(每串的长度不超过N),按顺序合并组成一个新的字符串。例如,若字符串数组
一棵完全二叉树共有360个结点,则在该二叉树中度为1的结点个数为
在关系数据库中,用来表示实体间联系的是()。
对长度为n的线性表排序,在最坏情况下,比较次数不是n(n—1)/2的排序方法是()。
在一棵二叉树上,第5层的结点数最多是()。
下面属于面向对象方法中对象基本特点的是
随机试题
在高速动平衡前可以不做低速动平衡试验。()
拟发行证券的公司采用公募方式发行证券其利在于()。
关于颅内脊索瘤CT表现,下列哪项是错误的
五硬好发于
跨越通车街道的低压绝缘接户线,导线至路面中心的垂直距离不应小于多少?
单件小批单步骤的生产企业应当采用品种法计算产品成本。()
以下不可以设定行政强制措施的法律规范是()。
关于当代中国社会主义法律价值体系的说法正确的是()。
设y=f(x)在(1,1)邻域有连续二阶导数,曲线y=f(x)在点P(1,1)处的曲率圆方程为x2+y2=2,则f″(1)=_________.
通常使用的密钥分发技术有__________技术和CA技术。
最新回复
(
0
)