单项选择题
有如下类的定义,横线处的语句是( )。
class TestClass
______ int x,y;
public:
TestClass(int a=0,int b=0)
X=a:
y=b;
static void change()
y-=10;
y-=10;
;
A.public
B.private
C.static
D.protected
点击查看答案&解析
<上一题
目录
下一题>
热门
试题
单项选择题
若有如下程序: #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::n=0; int main() sample a(2),b(5); sample::add(); cout<<s<<endl; return 0; 程序运行后的输出结果是( )。
A.2
B.5
C.7
D.3
点击查看答案&解析
单项选择题
若有以下程序: #include<iostream> using namespace std; class A public: A(int i,int j) a=i; b=j; void move(int x,int y) a+=x; b+=y; void show() cout<<a<< , <<b<<endl; private: int a,b; ; class B:private A public: B(int i,int j):A(i,j) void fun() move(3,5); void fl() A::show(); ; int main() B d(3,4); d.fun(); d.fl(); return 0; 程序执行后的输出结果是( )。
A.3,4
B.6,8
C.6,9
D.4,3
点击查看答案&解析
相关试题
有如下程序: #include<iostream> usi...
程序中有如下语句: for(int i=0;i<...
有一种只在循环语句或switch语句中使用的流...
执行以下程序后,输出结果第二行的内容是_...
______是一种特殊的成员函数,它主要...