• 2022-06-08
    有如下程序: #include <iostream> using namespace std; class AA int n; public: AA(int k):n(k) int get()return n; int get()constreturn n+1; int main() AA a(5); const AA b(6); cout<<
    A: get()<<
    B: get();
    C: return 0;
    D: 执行后的输出结果是( )。A. 55B. 57C. 75D. 77
  • B

    内容

    • 0

      给出下列【代码】注释标注的代码的输出结果。abstract class A {abstract int get(int a,int b);}public class E {public static void main(String args[]) {A a=new A() {public int get(int a,int b){return a+b;}};int m = a.get(2,5);a=new A() {public int get(int a,int b){return a*b;}};int n = a.get(2,5);System.out.printf("%d:%d",m,n);//【代码】}}

    • 1

      有如下类定义: class AA{ int a; public: AA(int n=0):a(n){} }; class BB :public AA{ public: BB(int x) __________ };其中划线处应填写的内容是 A: :AA(x){} B: :a(n){} C: {a(x);} D: {a=x;}

    • 2

      有如下程序: #include<iostream> using namespace std; class A{ public: static int a; void init( ){a=l;} A(int a=2){init( );a++;} }; int A::a=0; A obj; int main( ){ cout<<obj.a; return 0; } 程序的输出结果是 A: 0 B: 1 C: 2 D: 3

    • 3

      阅读程序题(给出【代码】注释标注的代码的输出结果)interface Com {int add(int a, int b);public static int get(int n){return n;}public default int see( int n){return n;}public default int look( int n) {return n;}}class A implements Com{public int add( int a, int b) { return a + b;}public int see(int n){ return n + 1;}}public class 习题5_阅读4{public static void main( String args[ ]) {A a = new A();int m = a.add(12,6);int n = Com.get( 12);int t = a.see(6);int q = a.look(6);System.out.printf("%d:%d:%d:%d",m,n, t,q); //【代码】 }}}

    • 4

      有以下程序: #include <iostream> using namespace std; class Base{ public: Base(int x=0) {cout<<x;} }; class Derived : public Base{ public: Derived(int x=0) {cout<<x;} private: Base val; }; int main(){ Derived d(1); return 0; } 程序的输出结果是