单项选择题
若有如下程序: #include <iostream> using namespace std; int s=0; class sample { static int n; public: sample (int i) { n=i; } static void add() { s+=n; } }; int sample: :s=0; int main () { sample a(2),b(5); sample:: add (); cout<<s<<end1; return 0; } 程序运行后的输出结果是( )。
A.2
B.5
C.7
D.3
点击查看答案&解析
<上一题
目录
下一题>
热门
试题
单项选择题
有如下程序段,请指出”p所代表的是( )。 int **p,*s,k=20; S = &k; p = &s;
A.s
B.&k
C.*p
D.k
点击查看答案&解析
单项选择题
下列对模板的声明中,正确的是( )。
A.temvlate<T>
B.template<classT1,T2>
C.temvlate<classT1,classT2>
D.template<classT1;classT2>
点击查看答案&解析
相关试题
有以下程序:#include <iostream>using...
有以下程序:#include<iostream>#inclu...
有以下程序:#include <iostream>#inc...
利用继承能够实现 【9】 。这种实现缩短...
有如下定义语句:MyClass*p[10];当类...