首页 > 计算机等级考试
题目内容 (请给出正确答案)
[主观题]

在下列程序的划线处应填入的语句是class Person {private int a;}public class Man extends Pers

在下列程序的划线处应填入的语句是class Person { private int a;}public class Man extends Person{ public int b; public static void main (String arg []){ Person p=new Person(); Man t=new Man(); int i: }}

A.i=w;

B.i=b

C.i=p.a;

D.i=t.b;

查看答案
答案
收藏
如果结果不匹配,请 联系老师 获取答案
您可能会需要:
您的账号:,可能还需要:
您的账号:
发送账号密码至手机
发送
安装优题宝APP,拍照搜题省时又省心!
更多“在下列程序的划线处应填入的语句是class Person {…”相关的问题
第1题
为了使程序的输出的正确结果为:Now is 2004.7.1010:10:10.那么应在下列程序划线处填入的正确语句

为了使程序的输出的正确结果为: Now is 2004.7.10 10:10:10. 那么应在下列程序划线处填入的正确语句是()。 那么应在下列程序划线处填入的正确语句是()。 #include <iostream> using namespace std; class TIME; class DATE { public: DATE(int y=2004,int m=1,int d=1) { year=y; month=m; day=d; } friend void DateTime(DATE &d, TIME &t); private: int year, month, day; }; class TIME { public: TIME(iht h=0, int m=0,int s=0) { hour=h; minute=m; second=s; } friend void DateTime(DATE &d,TIME &t); private: int hour,minute, second; }; ______________________ //函数 DateTime 的首部 { cout<<"Now is"<<d.year<<'.'<<d.month<<'.'<<d.day<< ' '<<t.hour<<":"<<t.minute<<':'<<t.second<<'.'<<end1; } int main () { DATE d(2004,7,10); TIME t(10, 10, 10); DateTime(d,t); return 0; }

A.void DateTime(DATE &d,TIME &t)

B.void TIME::DateTime(DATE &d,TIME &t) const

C.friend void DateTime(DATE &d,TIME &t)

D.void DATE::DateTime(DATE &d,TIME &t)

点击查看答案
第2题
为完成下面的程序,应在划线处填入的语句是()。#include<iostream>usingnamespacestd;classBase{pr

为完成下面的程序,应在划线处填入的语句是()。 #include <iostream> using namespace std; class Base { private: int x; public: Base(int i) { x=i; } ~Base(){} }; class Derived : public Base { public: _______________ //完成类Derive构造函数的定义 }; int main() { Derived Obj; return 0; }

A.Derived(int i):Base(i){}

B.Derived(){}

C.voidDerived(int i):Base(0){}

D.Derived(int i){Base(i);}

点击查看答案
第3题
为完成下面的程序,应在划线处填入的语句是#include<iostream>usingnamespace std;class Base{pri

为完成下面的程序,应在划线处填入的语句是 #include<iostream> using namespace std; class Base { private: int x; public: Base (int i) { x=i; } ~Base(){} }; class Derived:public Base { public: ______________//完成类Derive构造函数的定义 }; int main() { Derived Obj; return 0; }

A.Derived(int i):Base(i){}

B.Derived(){}

C.void Derived (int i):Base(i){}

D.Derived(int i){Base(i);}

点击查看答案
第4题
有如下程序:#include +using namespace std ;#includeusing namespace std;class Base{publ

有如下程序:

#include +

using namespace std ;

#include

using namespace std;

class Base

{

public:

void fun(){cout<<"Base::fun"<

};

class Derived:public Base

{

public:

void fun()

{

cout<<"Derived::fun"<

}

};

int main()

{

Derived d;

d.fun();

return 0;

}

已知其执行后的输出结果为:

Base::fun

Derived::fun

则程序中下划线处应填入的语句是

A . Base.fun();

B . Base::fun()

C . Base->fun()

D . fun();

点击查看答案
第5题
为使下列程序的正确输出结果为: Now is 2004-7-6 12:12:12 那么应该在程序划线处填入的语句是()。

为使下列程序的正确输出结果为: Now is 2004-7-6 12:12:12 那么应该在程序划线处填入的语句是()。 #include <iostream> using namespace std; class TIME; class DATE { public: DATE(int y=2004,int m=1,int d=1) { year=y; month=m; day=d; } void DateTime(TIME &t); private: int year,month, day; }; class TIME { public: TIME(int h=0,int m=0,int s=0) { hour=h; minute=m; second=s; } ______________; //将类 DATE 中成员函数 DateTime 声明为类 TIME 的友元函数 private: int hour,minute, second; }; void DATE: :DateTime(TIME &t) { cout<<"Now is "<<year<<'-'<<month<<'-'<<day<< ' '<<t.hour<<":"<<t.minute<<': '<<t.seoond<<'.'<<end1; } int main () { DATE d(2004,7,6); TIME t (12, 12, 12); d. DateTime (t); return 0; }

A.friend void DateTime(TIME &t);

B.friend void DATE::DateTime(TIME &0;

C.void DateTime(TIME &t);

D.friend void DateTime(TIME &t);

点击查看答案
第6题
下列程序中画线处应填入的语句是 classBase { public: voidfun(){cout<<”Baseoff

下列程序中画线处应填入的语句是

class Base

{

public:

void fun(){cout <<”Base of fun”<

};

class Derived:public Base

{

void fun()

{

//显示基类的成员函数fun

cout <<”Derived of fun”<

};

A.fun();

B.Base. fun();

C.Base::fun();

D.Base- >fun-:

点击查看答案
第7题
下列程序中下画线处应填入的语句是 class Base { public: void fun() {cout < < "Baseoffun" <

下列程序中下画线处应填入的语句是

class Base

{

public:

void fun() {cout < < "Baseoffun" < < endl;}

};

class Derived:public Base

{

void fun()

{

______//显示基类的成员函数fun

cout < < "Derived of fun" < < endl;

}

};

A.fun() ;

B.Base. fun() ;

C.Base: :fun() ;

D.Base->fun() ;

点击查看答案
第8题
下列程序中横线处应填入的语句是()。 classBase{public: voidfun(){cout<<"Baseoffun&

下列程序中横线处应填入的语句是()。

classBase

{

public:

voidfun(){cout<<"Baseoffun"<<endl;}};

classDerived:publicBase

{

voidfun()

{

//显示基类的成员函数fun

cout<<"Derivedoffun"<<endl;

}

};

A.fun();

B.Base.fun();

C.Base::fun();

D.Base->fun();

点击查看答案
第9题
用程序计算一个整数的各位数字的乘积,在下划线处应填写的语句是()。

用程序计算一个整数的各位数字的乘积,在下划线处应填写的语句是()。

请帮忙给出正确答案和分析,谢谢!

点击查看答案
第10题
下列程序中需要清理动态分配的数组,划线处应有的语句是_______。 include<iostream.h> class pers

下列程序中需要清理动态分配的数组,划线处应有的语句是_______。

include<iostream.h>

class person

{

int age,tall;

public:

person(){age=0;tall=40;cout<<"A baby is born."<<endl;}

person(int i){age=i;tall=40;cout<<"A old person."<<endl;}

person(int i,int j){age=i;tall=j;cout<<"a old person with tall."<<endl;)

~person(){cout<<"person dead."<<endl;}

void show()

{

cout<<"age="<<age<<",tall="<<tall<<endl;

}

};

void main()

{

person*ptr;

ptr=new person[3];

ptr[0]=person();

ptr[1]=person(18);

ptr[2]=person(20,120);

for(int i=0;i<3;i++)

ptr[i].show();

______

}

点击查看答案
退出 登录/注册
发送账号至手机
密码将被重置
获取验证码
发送
温馨提示
该问题答案仅针对搜题卡用户开放,请点击购买搜题卡。
马上购买搜题卡
我已购买搜题卡, 登录账号 继续查看答案
重置密码
确认修改