单项选择题

有如下类的定义。空格处的语句是
class MyClass
______int x,y;
public:
MyClass(int a=0,int b=0)
x=a;
y=b;
staticvoidchange()
x-=10;
y-=10;
;

A.static
B.const
C.private
D.不需要填入内容
<上一题 目录 下一题>
热门 试题

单项选择题
有如下程序: #include<iostream> using namespace std; class Base private: char c; piblic: Base(char n):c(n) ~Base() cout<<C; ; class DeriVed:public Base private: char c; public: Derived(char n):Base(n+1),c(n) ~Derived() cout<<c; ; int main() Derived obj(’x’); return 0; 执行上面的程序将输出
A.xy
B.yx
C.x
D.y
单项选择题
有以下程序 #include<iostream> using namespace std; class Base private: char c; public: Base(char n):c(n) ~Base() cout<<c; ; class Derived:public Base private: char c; public: Derived(char n):Base(n+1),c(n) ~Derived() cout<<c; ; int main() Derived obj(’x’); return 0; 执行后的输出结果是
A.xy
B.yx
C.x
D.y
相关试题
  • C++中,设置虚基类的目的是 【11】 。
  • 下面程序的输出结果是 【15】 。 #in...
  • 下面程序的输出结果为:Base::fun,请将...
  • 下列程序的输出结果是 【14】 #includ...
  • 多态性分为两类:编译时的多态性和 【10...