题目详情
当前位置:首页 > 职业培训考试
题目详情:
发布时间:2024-01-30 22:49:29

[单项选择]在下列横线处应添加的语句是( )。
class Base public:void fun( ) cout<<"Base::fun"<<end1; ;
class Derived:public Base

public:
void fun( )

//显示调用基类的fun函数
cout<<"Derived::fun"<<end1;

;
A. Derived::fun
B. Base::fun();
C. Pubic::fun
D. fun();

更多"在下列横线处应添加的语句是( )。 class Base publ"的相关试题:

[单项选择]在下列横线处应添加的语句是( )。
class Basepublic:void fun( )cout<<"Base::fun"<<end1;;
class: Derived: public Base

public:
void fun( )
 
   ______//显示调用基类的fun函数
 cout<<"Derived::fun"<<end1;
 
;
A. Derived::fun
B. Base::fun();
C. Pubic::fun
D. fun();
[单项选择]下列程序的输出结果为2,横线处应添加语句( )。
#include<iostream>
using namespace std;

public:
______void fun( )cout<<1;
;
class TestClass2:public TestClass1

public:void fun( )cout<<2;)
;
int main( )

TestClass1 *p=new TestClass2;
p->fun( );
delete p;
Teturn 0;

A. public
B. private
C. virtual
D. protected
[单项选择]下列程序将x、y和z按从小到大的顺序排列,横线处应添加语句( )。
template<class T>
void fun (______)

T a;
if(x>y)

a=x; x=y;y=a;

if(y>z)

a=y; y=z;z=a;

if(x>y)

a=x; x=y;y=a;


A. T x,T y,T z
B. T x;y;z
C. T &x,T &y,T &z
D. T &x,&y,&z
[填空题]请在下列程序中的横线处填写正确的语句: class Sample{ public: Sample( )( ) ~Sample( ){} void SetData(int data){//将Sample类成员变量data设置成形参的值 ______ } private:int data; };
[填空题]请将下列类定义补充完整。 class Base{public:void fun( ){cout<<"Base::fun"<<end;}}; class Derived:public Base { public: void fun( ) { 【13】 //显式调用基类的fun函数 cout<<"Derived::fun"<<endl; } };
[填空题]请将下列类定义补充完整。
class Base public: void fun( )cout<<"Base::fun"<<end1; ;
class Derived:public Basepublic:
void fun( ) 【15】 //显式调用基类的fun函数
cout<<"Derived:: fun"<<end1;;
[单项选择]下列程序的输出结果是 ( )
Public class fff

void printValue(int m)

doSystem.out.println("The value is"+m);
whilE(--m>10)

public static void main(String arg[])
int i=10;
Test t=new Test( );
t.printValue(i);


A. 8
B. 9
C. 10
D. 11
[单项选择]下列程序的输出结果是
public class fff
void printValue (int m)
do System.out.println("The value is" +m);

while(--m>10)

public static void main (String arg[])
int i=10;
Test t= new Test( );
t. printValue(i);


A. 8
B. 9
C. 10
D. 11
[单项选择]如下程序的输出结果是( )。
public class Test

void printValue(int m)

do
System.out.println("The value is"+m);

while(--m > 10 )

public static void main(String args[])

int i=10;
Test t= new Test( );
t.printValue(i);


A. The value is 8
B. The value is 9
C. The value is 10
D. The value is 11
[单项选择]下列语句输出结果为( )。
public class testpublic static void main(String args [])String s1=new String("How");
String s2=new String("How");
System.out. println(!(s1 ==s2));

A. false
B. true
C. 1
D. 0
[单项选择]在下面的类定义中,横线处应填入的内容是( )。
class Fred public:
void print( ) cout<<data<<end1;
void setData(double d)( data=d;
static int count;
private:

double data;

_______________________ count=O; //静态数据成员的定义
A. int
B. static int
C. int Fred::
D. static int Fred::
[单项选择]有以下程序不,在横线处应添加( )。
#include<iostream>
using namespace std;
class TestClass

public:
TestClass (int n) number=n;
______//拷贝构成函数
~TestClass ( )
private:
int number;
;
TestClass fun(TestClass p)
TestClass temp(p);
return temp;
int main( )

TestClass obj1(10),obj2(0);
TestClass obj3(obj1);
obj2=fun(obj3);
return 0;

A. TestClass (TestClass &other) number=other.number;
B. TestClass (TestClass other)number=other.number;
C. TestClass (TestClass &other)number;
D. TestClass (&other) number=other.number;
[单项选择]有如下类的定义。横线处的语句是( )。
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. 不需要填入内容

我来回答:

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

订单号:

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