下面程序段的输出结果是 class Base { int i; Base() { add(1); } void add(int v) { i+=v; } void print() { System.out.println(i); } } class Extension extends Base { Extension() { add(2); } void add(int v) { i+=*2; } } public class Test { public static void main(String args[]) { bogo(new Extension()); } static void bogo(Base b) { b.add(8); b.print(); } }A.9B.18C.20D.22
下面程序段的输出结果是 class Base { int i; Base() { add(1); } void add(int v) { i+=v; } void print() { System.out.println(i); } } class Extension extends Base { Extension() { add(2); } void add(int v) { i+=*2; } } public class Test { public static void main(String args[]) { bogo(new Extension()); } static void bogo(Base b) { b.add(8); b.print(); } }
A.9
B.18
C.20
D.22
相关考题:
下列程序的输出结果是非曲直【 】。includeclass base{ int x, y;public: base(int i, 下列程序的输出结果是非曲直【 】。include<iostream, h>class base{int x, y;public:base(int i, int j){x=i; y=j;}virtual int add(){return x+ y;}};class three: public base{int z;public:three(int i, int j, int k) :base(i, j){z=k; }int add() { return (base:: add()+z); }};void main(){three * q=new three(lO,20,30);cout<<q->add()<<end1;}
下面程序的输出结果是【】。 include using namespace std; int x; void funA(int,i 下面程序的输出结果是【 】。include<iostream>using namespace std;int x;void funA(int,int);void funB(int,int);int main(){int first;int second=5;x=6;funA(first,seconD) ;fimB(first,seconD) ;cout<<first<<" "<<second<<" "<<x<<end1;return 0;}void funA(int a,int B){int first;first=a+b;a=2*b;b=first+4;}void funB(int u,int v){int second;second=x;v=second+4;x=u+v;}
下面程序段的输出结果是 class Base { int i; Base() { add(1); } void add(int v) { i+=v; } void print() { System.out.println(i); } } class Extension extends Base { Extension() { add(2); } void add(int v) { i+=v*2; } } public class Test { public static void main(String args[]) { bogo(new Extension()); } static void bogo(Baseb){ b.add(8); b.print(); } }A.9B.18C.20D.22
如下程序是为变量i赋值。若程序的输出结果是180。请将程序补充完整。注意:不改动程序结构,不得增行或删行。class Base{int i;Base(){add(10);}void add(int v){i+=v;}void print(){System.out.println(i);}}class Extension extends Base{Extension(){add(______);}void add(int v){i+=v*2;}}public class ConstructTest3{public static void main(String args[]){bogo(new Extension());}static void bogo(Base b){b.add(60);b.print();}}
下面程序段中的错误语句是 ______。 class M{ int i; public: void ~AA(int); AA *p; void AA(); void AA(int x){i=x;}; };A.AA *p;B.void ~AA(int);C.void AA(int);D.void AA(int x){i=x;};
下面程序段的输出结果是( )。 class Base { int i; Base { add(1); } void add(int v) { i+=v: } void print { System.out.println(i); } } class Extension extends Base { Extension { add(2); } void add(int v) { i+=v*2: } } public class Test { public static void main(String args[]) { bogo(new Extension); } static void bogo(Base b) { add(8); print; } }A.9B.18C.20D.22
下面程序段的输出结果是( )。 classBase { inti; Base() { add(1); } voidadd(intV) { i+=v; } Voidphnt() { System.out.println(i); } } Class EXtenSiOneXtendSBaSe { ExtensiOn() { add(2); } voidadd(int v) { i+=v*2; } } public class TeSst { publicstatic voidmain(String argS[]) { bogo(new Extension()); } Static voidbogo(Base B) { b.add(8); b.phnt(); } }A.9B.18C.20D.22
下列程序的输出结果是______。 include class base { int x,y; public: base(int i,i 下列程序的输出结果是______。include<iostream.h>class base{int x,y;public:base(int i,int j){x=i;y=j;}virtual int add( ){return x+y;}};class three:public base{int z;public:three(int i,int j,int k):base(i,j){z=k;)int add( ){return(base::add( )+z);}};void main( ){three*q=new three(10,20,30);cout<<q->add( )<<endl;}
下列程序段执行结果是___________。 x = 1 print(type(x)) x = 1.0 print(type(x)) x = '1.0' print(type(x)A.<class 'int'> <class 'float'> <class 'str'>B.<class 'float'> <class 'int'> <class 'str'>C.<class 'str'> <class 'float'> <class 'int'>D.<class 'str'> <class 'int'> <class 'float'>