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

[单项选择]如下代码定义了一个类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);

更多"如下代码定义了一个类Test: class Test pr"的相关试题:

[单项选择]如下代码定义了一个类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 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=t.getX( );
[单项选择]类A定义如下: class A { private int x=10; int getx( ) { return x;} } class B extends A { private int x=15; //需要覆盖getx( )方法 } 在下述方法中可以在类B中覆盖getx( )方法的是 ( )
A. int getx(){…}
B. int getx(float {…}
C. float getx(){…}
D. double getx(float {…}
[单项选择]有如下类定义: 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 Cbase

private:int a;

protected:int b;

public:int c;

;

派生类采用何种继承方式可以使成员变量b成为自己的私有成员
A. 私有继承
B. 保护继承
C. 公有继承
D. 私有、保护、公有均可
[单项选择]设有基类定义:class Cbase{ private:int a;protected. int b;public:int c;};派生类采用何种继承方式可以使成员变量b成为自己的私有成员( )。
A. 私有继承
B. 保护继承
C. 公有继承
D. 私有、保护、公有均可
[单项选择]有以下类定义 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 TestClass int i; private:int j; protected:int k; public:int m,n; 其中,私有成员的数量为( )。
A. 0
B. 1
C. 2
D. 3
[单项选择]设有基类定义: class Cbase { private: int a; protected: int b; public: int c; }; 派生类采用何种继承方式可以使成员变量b成为自己的私有成员
A. 私有继承
B. 保护继承
C. 公有继承
D. 私有、保护、公有均可
[单项选择]设有基类定义: class Cbase { private:int a; protected:int b; public:int c; }; 派生类采用何种继承方式可以使成员变量b成为自己的私有成员
A. 私有继承
B. 保护继承
C. 公有继承
D. 私有、保护、公有均可
[单项选择]已知程序中已经定义了函数test,其原型是int test(int, int, int);,则下列重载形式中正确的是
A. char test(int,int,int);
B. double test(int,int,double);
C. int test(int,int,int=0);
D. float test(int,int,float=3.5F);
[单项选择]已知程序中已经定义了函数test,其原型是int test (int,int,int);,则下列重载形式中正确的是( )。
A. char test(int, int, in;
B. double test (int,int,doubl;
C. int test(int ,int, int=0);
D. float test(int,int,float=3.5;
[单项选择]已知程序中已经定义了函数test,其原型是int test(int,int,int);,则下列重载形式中正确的是______ 。
A. char test (int,int,int);
B. double test(int,int,double);
C. int test (int,int,int=0);
D. float test(int,int,float=3.5F);

我来回答:

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

订单号:

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