网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
在下面的类定义中,横线处应填入的内容是( )。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::
参考答案
更多 “ 在下面的类定义中,横线处应填入的内容是( )。class Fred{ public: void print() {cout<<data<<end1; void setData(double d)( data=d; static int count; private: double data;};_______________________ count=O; //静态数据成员的定义A.intB.static intC.int Fred::D.static int Fred:: ” 相关考题
考题
在下面的类定义中,横线处应填入的内容是 class Fred { public: void print(){cout<<data<<endl;} void setData(double d)(data=d;} static int count; private: double data; }; count=0; //静态数据成员的定义A.intB.static intC.int Fred::D.static int Fred::
考题
请将下列类定义补充完整,横线处应填加语句______。class TestClass{public:void fun(){cout<<"Base::fun"<<end1;}};class TestClass1:public TestClass{public:voidfun(){______;//显示调用基类的fun函数cout<<"TestClass1::fun"<<end1;}};
考题
下列程序打包到example包,main方法调用线程类输出0~9这10个数,请填写横线处的内容。注意:请勿改动main()主方法和其他已有语句内容,仅在横线处填入适当语句。______interface MyInterface{public abstract void print(int n);}class Mythread extends Thread ______ MyInterface{public void run(){for(int i = 0; i < 10; i++)this.print(i);}public void print(int n){System.out.print(n +" ");}}public class Example1_6{public static void main(String argv[]){Mythread th = new Mythread();______}}
考题
接口是抽象方法和常量的集合,是一种特殊的抽象类。下面的程序是对接口的操作,请在程序的每条横线处填写一个语句,使程序的功能完整。注意:请勿改动main()主方法和其他已有的语句内容,仅在横线处填入适当的语句。______________MyInterface{public static int NUM=100;public abstract void print();}public class ClassName___________MyInterface{public void print(){System.out.println(NUM);}public static void main(String args[]){__________________________obj .print();}}
考题
请将下列类定义补充完整class Base{public: void fun(){cout<<"Base::fun"<<end1;}};class Derived:public Base{public:void fun(){______//显式调用基类的fun函数cout<<"Derived::fun"<<end1;}};
考题
下列程序中声明了两个类AA和BB,其中函数“print”是类AA的成员函数,但是类BB的友元函数。请在①、②和⑧处各填入正确的内容,使程序能正常运行。include<iostream.h>【 】;class AA{int t;public:AA(int x){t=x;}void print(BB b) ;};class BB{int s;public:BB(int y){s=y;}friend void 【 】 print(BB );};void 【 】{ cout<<"AA:"<<t<<"BB: "<<w.s<<end1;}<void main(){AA m(6);BB n(8);m.print(n);}输出结果为:AA:6;BB:8
考题
在下面的程序的横线处填上适当的语句,使该程序的输出为12。include 〈iostream〉using namespace std;class Base{public:int a;Base(int i) { a=i;}};class Derived : public Base{int a;public:Derived(int x) : Base(x),b(x+1) {}void show(){【 】; //输出基类数据成员a的值cout〈〈b〈〈end1;}};int main(){Derived d(1);d.show();return 0;}
考题
在下面的定义语句中,画线处应填入的内容是 class Fred{ public: void print( ){cout<<data<<endl;} void setData(double D) {data=d;} static int count; private: double data; }; ______count=0;//静态数据成员的定义A.intB.static intC.int Fred::D.static int Fred::
考题
请在下列程序中的横线处填写正确的语句。include using namespace std; class Base{ pu
请在下列程序中的横线处填写正确的语句。include<iostream>using namespace std;class Base{public:void fun(){cout<<“Basefun”<<endl;});class Derivde:public Base{public:void fun(){//调用基类的函数fun()cout<<“Derived fun”<<endl;}};
考题
有以下程序inclube class ClassOne{public: ClassOne(int v=O) { i=v;cout
有以下程序 #inclube <iostream.h> class ClassOne { public: ClassOne(int v=O) { i=v;cout<<i;} void print(){ cout<<i<<end1;} }; class ClassTwo { public: ClassTwo(int v=O) { i=v;cout<<i;} void print(){ cout<<i<<end1;} private: ClassOne myObj; int i; }; void main() { ClassTwo obj(1); obj.print(); }A.11B.111C.110D.101
考题
在下列横线处应添加的语句是( )。 class Base{public:void fun(){cout<<"Base::fun"<<end1;}}; class: Derived: public Base { public: void fun() { ______//显示调用基类的fun函数 cout<<"Derived::fun"<<end1; } };A.Derived::funB.Base::fun();C.Pubic::funD.fun();
考题
下列程序中横线处正确的语句是()。includeusing namespace std;class TestClass{publi
下列程序中横线处正确的语句是( )。 #include<iostream> using namespace std; class TestClass { public: void fun(){cout<<"TestClass::fun"<<end1;} }; class TestClass1:public TestClass { void fun() { ______//显示调用基类的函数 fun() cout<<"TestClass1::fun"<<end1; } };A.fun();B.TestClass.fun()C.TestClass::fun();D.TestClass->fun();
考题
在下列程序画线处填入的正确语句是()。includeusing namespace std;classBase{public:
在下列程序画线处填入的正确语句是( )。 #include <iostream> using namespace std; class Base { public: void fun() { cout<<"Base::fun",<<end1; } }; class Derived:public Base { void fun() { ______________ //显式调A.fun();B.Base.fun();C.Base::fun();D.Base->fun();
考题
在下面的类定义中,横线处应填入的内容是 class Fred { public: void print () { cout<<data<<end1;} void setData (double D) {data=d; static int count; private: double data; };______count=0; //静态数据成员的定义A.intB.static intC.int Fred::D.static int Fred::
考题
有如下程序:include using namespace std;class Base{public:void fun() {cout
有如下程序:#include <iostream>using namespace std;class Base { public: void fun() {cout<<"Base:: fun"<<end1; }};class Derived: public Base ( public: void fun() { ____________________________ cout<<"Derived:: fun"<<end1; }};int main() { Derived d; D. fun(); return O;}已知其执行后的输出结果为:Base:: funDerived:: fun则程序中下划线处应填入的语句是( )。A.Base. fun ();B.Base:: fun ();C.Base->fun();D.fun()
考题
请将下列类定义补充完整。class Base{public:void fun(){cout<<"Base∷fun"<<end1;}};c1ass DehVed:public Base{public:void fun(){______ ∥显式调用基类的fun函数cout<<"Derived∷fun"<<endl;}};
考题
在下面程序的横线处填上适当的内容,使程序执行后的输出结果为ABCD。 include usingn
在下面程序的横线处填上适当的内容,使程序执行后的输出结果为ABCD。include <iostream.h>using namespace std;class A{public: A() {cout<<'A';};class B:______{public: B() {cout<<'B';}};class C:______{public: C(} cout<<'C';}};class D:public B, public C{public: D(){cout<<'D';}};void main(){D obj;}
考题
有以下程序: include class A { intx; public: A(int a) { x=a;} friend class B;
有以下程序:include<iostream.h>class A{int x;public:A(int a){x=a;}friend class B;}class B{public:void print(A a){a. x--;cout<<a.x<<end1;}};void main(){A a(10);B b;b.print(a) ;}程序执行后的输出结果是【 】。
考题
下列程序中画线处应填入的语句是 class Base { public: void fun( ){cout<<"Base of fun"<<end1;} }; class Derived:public Base { void fun( ) { ______//显示基类的成员函数fun cout<A.fun( );B.Base.fun( );C.Base: :fun( );D.Base->fun( );
考题
写出下列程序代码运行的结果【】。 include class A{public:virtual void disp() {cout
写出下列程序代码运行的结果【 】。include<iostream.h>class A{public:virtual void disp() {cout<<" calss A!" <<(end1;}}:class B: public A{public:void disp() {cout<<" class B! " <<end1:}};class C: public A{public:void disp() {cout<<"class C! " (<end1;}};void main() {A a, *ptr;B b;C c;a. disp();b. disp();c. disp();ptr=b;ptr->disp();ptr=c;ptr->disp():}
考题
应在下列程序画线处填入的正确语句是 ( )。include using namespace std;clas Base{pu
应在下列程序画线处填入的正确语句是 ( )。 #include <iostream> using namespace std; clas Base { public: void fun() { cout<<"Base::fun"<<end1; } }; class Derived : public Base { void fun() { ________________//显示调用基类的函数 fun() cout<<"Derived::fun"<<end1; } };A.fun();B.Base.fun();C.Base::fun();D.Base->fun();
考题
下列程序中画线处应填入的语句是 class Base { public: void fun(){cout<<"Base of fun"<<end1:} }; class Derived:public Base { void fun() { _______//显示基类的成员函数fun cout<<"Derived of fun"<<end1; } };A.fun();B.Base.fun();C.Base∷fun();D.Base- >fun();
考题
为使程序的输出结果为: Base:: fun 那么应在下列程序画线处填入的正确语句是( )。 #include <iostream> using namespace std; class Base { public: void fun () { cout<<"Base: :fun"<<end1; } }; class Derived : public Base { public: void fun ( ) { cout<<"Derived: :fun"<<end1; } }; int main ( ) { Base a,*pb; Derived b; _________; pb->fun(); //调用基类的成员函数 fun() return 0 ; }A.pb=aB.pb=bC.pb=bD.pb=Base
考题
下列程序中横线处应填入的语句是( )。 Class Base { public: roid fun(){cout<<“Base of fun”<<endl;) }; class Derived:public Base { void fun() { //显示基类的成员函数fun cout<<“Derived Of fun”<<endl; } };A.fun();B.Base.fun();C.Base::fun();D.Base->fun();
考题
设有以下定义和程序:includeclassA1{public: void showl() { cout
设有以下定义和程序: #include <iostream.h> class A1 { public: void showl() { cout<<"class A1"<<end1; } }; Class A2 : public A1 { public: void show2() { cout<<"Class A2"<<end1; } }; Class A3 : protected A2 { public: void show3() { cout<<”Class A土”<<end1; } }; void main() { A1 obj1; A2 obj2; A3 obj3; } 则以下不合语法的调用语句是( )。A.obj1.show1();B.obj2.show1();C.obj3.show1();D.obj2.show2();
考题
下列程序中划线处正确的语句是()。include using namespace std;class Base{public:vo
下列程序中划线处正确的语句是( )。#include <iostream>using namespace std;class Base{public:void fun() { cout<<"Base:: fun"<<end1; }};class Derived: public Base{ void fun() { _______________________ //显试调用基类的函数 fun() cout <<"Derived:: fun"<<end1;};A.fun();B.Base. fun();C.Base:: fun();D.Base->fun();
考题
请在下列程序的横线处填写正确的语句。include using namespace std; class Base{ publ
请在下列程序的横线处填写正确的语句。include<iostream>using namespace std;class Base{public:void fun(){cout<<"Base fun"<<endl;}};class Derivde:public Base{public:void fun(){______∥ 调用基类的函数
考题
在下面程序的横线处填上适当的内容,使程序执行后的输出结果为ABCD。 include using nam
在下面程序的横线处填上适当的内容,使程序执行后的输出结果为ABCD。include<iostream>using namespace std;class A{public: A(){cout<<'A';}};class B:【 】{public:B(){cout<<'B';)};class C:【 】{public;C(){cout<<'C';}};class D:public B,public C{public:D(){cout<<'D';}};void main(){D obi;}
热门标签
最新试卷