题目详情
当前位置:首页 > 职业培训考试
题目详情:
发布时间:2023-10-14 10:14:10

[单项选择]有如下类定义: class Point{ private: static int how_many; }; ______how_many=0; 要初始化Point类的静态成员how_many,下划线处应填入的内容是
A. int
B. static int
C. int Point: :
D. static int Point

更多"有如下类定义: class Point{ priv"的相关试题:

[单项选择]有如下类定义: class Point{ private: static int how_many; }; ______how_many=0; 要初始化Point类的静态成员how_many,下划线处应填入的内容是
A. int
B. static int
C. int Point: :
D. static int Point
[单项选择]有如下类定义: class Point{ private: static int how_many; }; ______how_many=0; 要初始化Point类的静态成员how_many,下划线处应填入的内容是
A. int
B. static int
C. int Point: :
D. static int Point
[单项选择]有如下类定义 class MyClass public: Private: int data; }; 若要为MyClass类重载流输入运算符>>,使得程序中可以“cin>>obj;”形式输入MyClass类的对象obj,则横线处的声明语句应为( )。
A. friend istream& operator>>(istream& is, MyClass& A) ;
B. friend istream& operator>>(istream& is, MyClass A) ;
C. istream& operator>>(istream& is, MyClass& A) ;
D. istream& operator>>(istream& is, MyClass A) ;
[单项选择]有如下类定义: class Test { private int x; public int y; public void setX (int m) {x=m;} public int getX( ) {return x;} }现用Test t=new Text( );生成一个对象t,则如下语句中,错误的是( )。
A. x=10;
B. y=10;
C. setX(10);
D. int m=getX( );
[单项选择]有如下类定义: class B{ public: void fun1( ){} private: void fun2( ){} protected: void fun3( ){} }; class D: public B{ protected: void fun4( ){} }; 若obj是类D的对象,则下列语句中不违反访问控制权限的是( )。
A. obj. fun1();
B. obj. fun2();
C. obj. fun3();
D. obj. fun4();
[单项选择]有如下类定义:class Point{int x__, y__;public:Point( ): x_(0), y_(0) {}Point(int x, int y =0): x_(x), y_(y) {}若执行语句Point a(2),b[3], *c[4];则Point 类的构造函数被调用的次数是( )。
A. 2次
B. 3次
C. 4次
D. 5次
[单项选择]有如下类定义: class Point { int x_,y_; public: Point( ):x_(0),y_(0){} Point(int x,int y=0):x_(x),y_(y){} }; 若执行语句 Point a(2),b[3],*c[4]; 则Point类的构造函数被调用的次数是
A. 2次
B. 3次
C. 4次
D. 5次
[单项选择]有如下类声明: class TestClass int i; private:int j; protected:int k; public:int m,n; 其中,私有成员的数量为( )。
A. 0
B. 1
C. 2
D. 3
[单项选择]有如下类模板定义:   template   class BigNumber{   long n;   public:   BigNumber(T i):n(i){}   BigNumber operator+(BigNumber b){   return BigNumber(n+b.n);   }   };   己知b1、b2是BigNumber的两个对象,则下列表达式中错误的是
A. bl+b2
B. b1+3
C. 3+b1
D. 3+3
[单项选择]

有如下类定义和变量定义:
class Parents{
public:
int publicData;
private:
int privateData;
};
class ChildA:public Parents{/*类体略*/};
class ChildB:private Parents{/*类体略*/};
ChildA a;
ChildB b;
下列语句中正确的是()


A. cout<<publicData<<endl;
B. cout<<privateData<<endl;
C. cout<<publicData<<endl;
D. cout<<privateData<<endl;
[单项选择]有以下类定义 class MyClass { private: int id; char gender; char*phone; public: MyClass( ):id(0),gender('#'),phone(NULL){} MyClass(int no,char ge='#',char*ph=NULL) {id=no;gender=ge;phone=ph;} }; 下列类对象定义语句中错误的是
[单项选择]有以下类定义 class MyClass { private: int id; Char gender; Char*phone; public: MyClass( ):id(0),gender(‘#’),phone(NULL){} MyClass(int no,charge=’#’,char*ph=NULL) {id=no;gender=ge;phone=ph;} ); 下列类对象定义语句中错误的是( )。
A. MyClass myObj;
B. MyClass myObj(11,”13301111155”);
C. MyClassmyObj(12,’m’);
D. MyClassmyObj(12);
[单项选择]有如下类的定义。横线处的语句是( )。class MyClass{public:MyClass(int a=0,int b=0){X=a;Y=b;}void Change( )const{X=10;Y+=10;}private:___________________int X,Y;};
A. static
B. const
C. mutable
D. 不需要填入内容
[单项选择]有如下类的定义。那么空格处的语句是( )。 class MyClass { ____________int x,y; public: MyClass(int x1=0,int y1=0) { x=x1; y=y1; } static void change( ) { x+=10; y+=10; } };
A. static
B. const
C. private
D. 不需要填入内容
[单项选择]有如下类的定义。空格处的语句是 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. 不需要填入内容
[单项选择]有如下类的定义。应在空格处填入的语句是 ( )。 class MyClass { ______________ int x, y; public: MyClass(int a=0,int b=0) { x=a; y=b; } static void change{) { x-=10; y-=10; };
A. static
B. const
C. mutable
D. 不需要填入内容
[单项选择]设有基类定义: class Cbase { private:int a; protected:int b; public:int c; }; 派生类采用何种继承方式可以使成员变量b成为自己的私有成员
A. 私有继承
B. 保护继承
C. 公有继承
D. 私有、保护、公有均可
[单项选择]如下代码定义了一个类Test: class Test { private int y; Test (int x) { y:x; } }现在为Test 类生成一个对象,正确的语句是( )。
A. Test t = new Test( );
B. Test t=new Test(10, 20);
C. Test t;
D. Test t=new Test(10);
[单项选择]有如下类定义: Class MyClass{ int value; public: MyClass(int n): value(n){} int getValue( )const{return value;} }; 则类MyClass的构造函数的个数是
A. 1个
B. 2个
C. 3个
D. 4个

我来回答:

购买搜题卡查看答案
[会员特权] 开通VIP, 查看 全部题目答案
[会员特权] 享免全部广告特权
推荐91天
¥36.8
¥80元
31天
¥20.8
¥40元
365天
¥88.8
¥188元
请选择支付方式
  • 微信支付
  • 支付宝支付
点击支付即表示同意并接受了《购买须知》
立即支付 系统将自动为您注册账号
请使用微信扫码支付

订单号:

请不要关闭本页面,支付完成后请点击【支付完成】按钮
恭喜您,购买搜题卡成功
重要提示:请拍照或截图保存账号密码!
我要搜题网官网:https://www.woyaosouti.com
我已记住账号密码