能将程序补充完整的选项是 class Person { private int a; public int change(int m){return m; } } public class Teacher extends Person { public int b; public static void main(String arg[]) { Person p=new Person(); Teacher t=new Teacher(); int i; ______ } }A.i=mB.i=bC.i=p.aD.i=p.change(50)

能将程序补充完整的选项是 class Person { private int a; public int change(int m){return m; } } public class Teacher extends Person { public int b; public static void main(String arg[]) { Person p=new Person(); Teacher t=new Teacher(); int i; ______ } }

A.i=m

B.i=b

C.i=p.a

D.i=p.change(50)


相关考题:

有如下类定义,请将Sample类的复制构造函数补充完整。class Sample{public:Sample( ){ }~Sample( ){if(P)delete P;)Sample(const Samples){______}void SetData(int datA) {P=new int(datA) ;}private:int*P:};

现有如下程序段#include "stdio.h"int fun(int k,int *m){if(k%3)*m=k*k;else *m=k/3;}main(){ int (*p)(int,int *),m;p=fun;(*p)(78, m);printf( "%d\n",m);}则程序段的输出结果为A.24B.25C.26D.27

下列程序在构造函数和析构函数中申请和释放类的数据成员int * a,申请时使用形参b初始化a,请填空。class A{public:A(int b) ;~A( ) ;private:int * a;};A: :A(int b){______;}A: :~A( ){______;}

下列程序的运行结果是 includeclass Location{private:int X.Y;public:void init(i 下列程序的运行结果是 #include<iostream.h> class Location{ private: int X.Y; public: void init(int=0,int=0); void valueX(int val){X=val;} int valueX( ){ return X;} void valueYA.5 0 6 4B.0 0 6 4C.5 0 6 2D.0 0 6 2

有以下程序includestdio.hint*f(int*p,int*q);main( ){int m=1,n=2,*r=m;r=f(r,stdio.hint*f(int*p,int*q);main( ){int m=1,n=2,*r=m;r=f(r,n);printf(”%d\n”,*r);}int-f(int*P,int*q)(return(*p*q)?p:q;)程序运行后的输出结果是______。

有如下类定义,请将Sample类的拷贝构造函数补充完整。class Sample{public:Sample(){)~Sample(){if(p)delete p;)Sample(const Sample s){______}void SetData(int data) {p=new int(data);}private:int*p;};

以下程序的输出结果是#include "stdio.h"int *fun(int *a,int *b){ int m; m=*a; m+=*b-3; return(m);}main(){ int x=21,y=35,*a=x,*b=y; int *k; k=fun(a,b); printf("%d\n",*k);}

申请一个m行n列的整型的二维动态数组,可以使用下面的哪条语句?A.p = (int *) malloc(m*n*sizeof(int));B.p = (int *)calloc(m*n, sizeof(int));C.p = (int *) malloc(m*n, sizeof(int));D.p = (int *)calloc(m * n * sizeof(int));E.int p[m][n];F.p = (int *) realloc(m * n * sizeof(int));

12、申请一个m行n列的整型的二维动态数组,可以使用下面的哪条语句?A.p = (int *) malloc(m*n*sizeof(int));B.p = (int *)calloc(m*n, sizeof(int));C.p = (int *) malloc(m*n, sizeof(int));D.p = (int *)calloc(m * n * sizeof(int));E.int p[m][n];F.p = (int *) realloc(m * n * sizeof(int));

7、申请一个m×n二维int型动态数组,可以使用语句()。A.int *p; p=(int *)calloc(m*n*sizeof(int));B.int p[m][n];C.int *p; p=(int *)calloc(m*n,sizeof(int));D.int *p; p=(int *)malloc(m*n,sizeof(int));