网友您好, 请在下方输入框内输入要搜索的题目:

题目内容 (请给出正确答案)

下列程序错误的原因是()  Sealed  class  SealedClass{  }   Class  Derived:SealedClass{  }

  • A、  SealedClass类不能被继承
  • B、  没有Main()入口
  • C、  SealedClass没有被实例化
  • D、  以上皆是

参考答案

更多 “ 下列程序错误的原因是()  Sealed  class  SealedClass{  }   Class  Derived:SealedClass{  }A、  SealedClass类不能被继承B、  没有Main()入口C、  SealedClass没有被实例化D、  以上皆是” 相关考题
考题 如果不能使用多态机制,那么通过基类的指针虽然可以指向派生类对象,但是只能访问从基数继承的成员,下列程序没有使用多态机制,其输出结果是( ) 。#includeusing namespace std;class Base{public:Void print(){cout ‘B’;}};class Derived: public Base{publicvoid print(){cout ‘D’;}}int main(){Derived*pd=new Dreived);Base*pb=pd;pb-print();pd-print();delete pd;return 0;}

考题 有如下程序#includeusing namespace std;class Base{protected;Base(){cout’A’;}Base(char c){cout};class Derived; public Base{public:Derived(char c ){cout };int main(){Derived d1(‘B’);return 0;}执行这个程序屏幕上将显示输出______。A.BB.BAC.ABD.BB

考题 有以下程序: included using namespace std; class Base { public: Base( ) { x=0; } 有以下程序:included<iostream>using namespace std;class Base{public:Base( ){x=0;}int x;};class Derived1:virtual public Base{public:Derived1( ){x=10;}};class Derived2:virtual public Base{public:Derived2( ){x=20;}};class Derived: public Derived1,protected Derived2{ };int main( ){Derived obj;cout<<obj. x<<endl;return 0;}该程序运行后的输出结果是______。

考题 有如下程序 include using namespace std; class Base { protected: 有如下程序 #include <iostream> using namespace std; class Base { protected: Base( ){cout<<'A'; } Base(char c) { cout<<c; } }; class Derived: public Base { public: Derived(char c){ cout<<c; } }; int main( ){ Derived d1 ('B'); return 0; } 执行这个程序屏幕上将显示输出A.BB.BAC.ABD.BB

考题 ( 11 ) 如果不使用多态机制 , 那么通过基类的指针虽然可以指向派生类对象 , 但是只能访问从基类继承的成员。下列程序没有使用多态机制,其输出结果是 【 11 】 。#includeusing namespace std;class Base {public:void print ( ) { cout 'B'; } };class Derived : public Base {public:void print ( ) { cout 'D'; }};int main( ){Derived* pd = new Derived( );Base* pb = pd;pb-print( );pd-print( );delete pd;return 0;}

考题 有如下程序: include using namespace std; class BASE { public 有如下程序: #include<iostream> using namespace std; class BASE { public: ~BASE(){cout<<"BASE";} }; class DERIVED:public BASE { public: ~DERIVED(){cout<<"DERIVED";} }; int main(){DERIVEDx;retum 0;} 执行后的输出结果是A.BASEB.DERIVEDC.BASEDERIVEDD.DERIVEDBASE

考题 有如下程序:includeusing namespace std;class Base{protected:Base(){cout 有如下程序: #include<iostream> using namespace std; class Base{ protected: Base(){cout<<'Base';} Base(char c){cout<<c;} }; class Derived:public Base{ public: Derived(char c){cout<<c;} }; int main(){ Derived d('Derived'); return 0; } 执行这个程序屏幕上将显示输出( )。A.DerivedB.DerivedBaseC.BaseDerivedD.DerivedDerived

考题 有如下程序:include using namespace std;class BASE{public:~BASE(){cout 有如下程序: #include <iostream> using namespace std; class BASE{ public: ~BASE(){cout<<"BASE";} }; class DERIVED:public BASE{ public: ~DERIVED(){cout<<"DERIVED";} }; int main(){DERIVED x;return 0;} 执行后的输出结果是A.BASEB.DERIVEDC.BASEDERIVEDD.DERIVEDBASE

考题 有如下程序:includeusing namespace std;class BASE{public:~BASE( ){cout 有如下程序: #include<iostream> using namespace std; class BASE{ public: ~BASE( ){cout<<"BASE";} }; class DERIVED:public BASE{ public: ~DERIVED( ){cout<<"DERIVED";} }; int main( ){DERIVED x;return 0;} 程序的输出结果是A.BASEB.DERIVEDC.BASEDERIVEDD.DERIVEDBASE

考题 不能被实例化的类是 ( )A.Object类B.Class类C.Dictionary类D.System类

考题 有如下程序: include using namespace std; class Base{ public: int m,n; }; class D 有如下程序:include<iostream>using namespace std;class Base{public:int m,n;};class Derived1:【 】Base{};class Derived2:public Derived1{public:void SetMN(int M,int N){m=M;n=N;}int GetSumMN(){return(m+n);}};int main() {Derived2 objD;ohjD. SetMN(3,4);cout<<"M+N="<<objD, m+objD, n<<endl;return 0}编译时只有“cout<<"M+N"<<objD.m+objD.n<<endl;”有语法错误,程序的其他地方没有语法错误。请判断下划线处使用的关键字是什么。

考题 下列程序编译时发现pb->f(10);语句出现错误,其原因是______。 include class Base { 下列程序编译时发现pb->f(10);语句出现错误,其原因是______。include<iostream.h>class Base{public:void f(int x){cout<<"Base:"<<x<<endl;)};class Derived:public Base{public:void f(char*str){cout<<"Derived:"<<str<<endl;}};void main(void){Derived*pd=new Derived;Pd->f(10);}

考题 下面程序定义了一个类,关于该类说法正确的是( )。abstract class abstract Class{}A.该类能调用newabstractClass( );方法实例化为一个对象B.该类不能被继承C.该类的方法不能被重载D.以上说法都不对

考题 若有以下程序:include using namespace std; class Base public: Base() { x=0;} in 若有以下程序: #include <iostream> using namespace std; class Base public: Base() { x=0; } int x; }; class Derivedl: virtual public Base public: Derived1() { x=10; } }; class Derived2: virtual public Base publici Derived2() x=20; }; class Derived :public Derived1,protected Derived2 {}; int main() Derived obj; cout<<obj.x<<end1; return 0; } 该程序运行后的输出结果是A.20B.30C.10D.0

考题 若有以下程序: include using namespace std;class Base{public:Base ( ){x=0;}int x 若有以下程序:# include <iostream>using namespace std;class Base{public: Base ( ) { x=0; } int x;};class Derived1 : virtual public Base{public: Derived1 ( ) { x=10; }}; class Derived2 : virtual public Base{public: Derived2 () { x=20; }};class Derived : public Derived1,protected Derived2{ };int main(){ Derived obj; cout<<obj.x<<end1; return 0;} 该程序运行后的输出结果是A.10B.20C.30D.0

考题 若有以下程序:include using namespace std;class Base{public:Base (){x=0;}int x;} 若有以下程序: #include <iostream> using namespace std; class Base { public: Base () { x=0; } int x; }; class Derived1 : virtual public Base { public: Derived1 () { x=10; } }; class Derived2 : virtual public Base { public: Derived2 () { x=20; } }; class Derived : public Derived1,protected Derived2{ }; int main() { Derived obi; cout<<obj.x<<endl; return 0; } 该程序运行后的输出结果是A.20B.30C.10D.0

考题 有如下程序includeusing namespace std;class Base{protected:Base(){cout 有如下程序 #include<iostream> using namespace std; class Base{ protected: Base(){cout<<'A';} Base(char c){cout<<c;) }; class Derived: public Base{ public: Derived(char c){cout<<c;) }; int main(){ Derived dl('B'); return 0; } 执行这个程序屏幕上将显示输出( )。A.BB.BAC.ABD.BB

考题 有如下程序: #includeiostroam using namespace std; class Base{ protected: Base{cout’A’;} Base(char C){coutc;} }; class Derived:public Base{ public: Derived(char C){toutC;} }; int main{ Derived dl(’B’); retum 0; } 执行这个程序的输出结果是( )。A.BB.BAC.ABD.BB

考题 有如下程序:includeusing namespace std;class BASE{public:~BASE(){cout 有如下程序: #include<iostream> using namespace std; class BASE{ public: ~BASE(){cout<<"BASE";} }; class DERIVED:public BASE{ public: ~DERIVED(){cout<<"DERIVED";} }; int main(){DERIVED x;return 0;} 执行后的输出结果是( )。A.BASEB.DERIVEDC.BASEDERIVEDD.DERIVEDBASE

考题 下列程序的运行结果是______。 include class Base { public: virtual void func(int 下列程序的运行结果是______。include<iostream.h>class Base{public:virtual void func(int i){cout<<"class Base:"<<i<<end1;)};class Derived: public Base{public:void func(double d){cout<<"class Derived:"<<d<<endl;}};void main( ){Base a,*p=a;Derived b;p=b;(*p).func(3.3);}

考题 以下程序的调试结果为?class Base{public final void amethod(){System.out.println("amethod");}}public class Fin extends Base{public static void main(String argv[]){Base b = new Base();b.amethod();}} A.编译指示带有final 方法的类自己必须定义为finalB.编译指示不能继承含有final 方法的类C.运行错误,原因是Base类没有定义为final类D.运行输出 amethod

考题 在下面横线上填上适当的语句,完成程序。include using namespace std; class Base { in 在下面横线上填上适当的语句,完成程序。include<iostream>using namespace std;class Base{int x;public:Base(int i){x=i;}~Base(){});class Derived:public Base{public:______//完成类Derive构造函数的定义};iht main(){Derived obj

考题 如果不使用多态机制,那么通过基类的指针虽然可以指向派生类对象,但是只能访问问从基类继承的成员。下列程序没有使用多态机制,其输出结果是【 】。include <iostream>using namespace std;class Base {public:void print ( ) {cout << 'B'; }};class Derived: public Base {public:void print ( ) {cout <<'D';}};int main( ){Derived* pd = new Derived( );Base* pb = pd;pb->print( );pd-print();delete pd;return 0;}

考题 以public修饰的类如:public class Car{…} 则Car()A、可被其它程序包中的类使用B、仅能被本程序包中的类使用C、不能被任意其它类使用D、不能被其它类继承

考题 下面程序定义了一个类,关于该类说法正确的是()。 abstract class abstractClass { „„ }A、该类能调用new abstractClass()方法实例化为一个对象B、该类不能被继承C、该类的方法都不能被重载D、以上说法都不对

考题 单选题下列程序错误的原因是()  Sealed  class  SealedClass{  }   Class  Derived:SealedClass{  }A   SealedClass类不能被继承B   没有Main()入口C   SealedClass没有被实例化D   以上皆是

考题 单选题下面程序定义了一个类,关于该类说法正确的是()。 abstract class abstractClass { „„ }A 该类能调用new abstractClass()方法实例化为一个对象B 该类不能被继承C 该类的方法都不能被重载D 以上说法都不对