( 30 )有如下程序:#includeiostreamusing namespace std;public:AA(){ cout'1'; }};class BB: public AA{int k;public:BB():k(0){ cout'2'; }BB(int n):k(n){ cout'3';}}int main(){BB b(4), c;return 0;}运行时的输出结果是A ) 1312B ) 132C ) 32D ) 1412
( 30 )有如下程序:
#include<iostream>
using namespace std;
public:
AA(){ cout<<'1'; }
};
class BB: public AA{
int k;
public:
BB():k(0){ cout<<'2'; }
BB(int n):k(n){ cout<<'3';}
}
int main(){
BB b(4), c;
return 0;
}
运行时的输出结果是
A ) 1312
B ) 132
C ) 32
D ) 1412
相关考题:
( 10 )有如下程序:#includeiostreamusing namespace std;class A{public:A(){cout"A" ; }~A(){cout"A" ; }} ;class B {A a;public:B(){cout"B";}~B(){cout"B";}};int main (){B b;return 0;}程序的输出结果是 ___________
有如下程序:includeusing name。pace std;class AA{int n:public:AA(int k):n(k){}in 有如下程序: #include<iostream> using name。pace std; class AA{ int n: public: AA(int k):n(k){} in get( ){return n;} int get( )const{return n+1;} }; int main( ){ AA a(5); const AA b(6); cout<<a.get( )<<b.get( ); return 0: 执行后的输出结果是A.55B.57C.75D.77
有如下程序:include using namespace std;class AA {int n;public:AA(int k):n(k) {} 有如下程序:#include <iostream>using namespace std;class AA { int n;public: AA(int k):n(k) {} int get(){return n;} int get()const { return n+1; }};int main(){ AAa(5); const AA b(6); cout<<a. get()<<b. get(); return ();}执行后的输出结果是( )。A.55B.57C.75D.77
有以下程序: 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) ;}程序执行后的输出结果是【 】。
有如下程序:include using namespace std;class AA{public: virtual void f() {cout 有如下程序: #include <iostream> using namespace std; class AA { public: virtual void f() { cout<< "AA"; } }; class BB : public AA { public: BB() { cout << "BB"; } }; claA.AAB.AABBCCC.BBAABBCCD.BBBBAACC
有如下程序:includeusing namespace std;class AA{ int n;public: AA(int k):n (k){} 有如下程序: #include<iostream> using namespace std; class AA{ int n; public: AA(int k):n (k){} int get(){return n;) int get()const{return n+1;} }; int main() { AA a(5); const AA b(6); cout<<a.get()<<b.get(); return 0; } 执行后的输出结果是A.55B.57C.75D.77
有如下程序: include using namespaee std; class A{ public: A( ){cout 有如下程序:include<iostream>using namespaee std;class A{public:A( ){cout<<"A";}~A( ){cout<<"A";}};class B{A a;public:B( ){cout<<"B";}~B( )t cout<<"B";}};int main( ){B b;return 0;}程序的输出结果是______。
有如下程序:includeusing namespaee std;class AA{public:AA( ){cout 有如下程序: #include<iostreanl> using namespaee std; class AA{ public: AA( ){cout<<'1';} }; class BB:public AA{ int k; public: BB( ):k(0){eout<<'2';} BB(int n):k(n){cout<<'3';} }; int main( ){ BB,b(4),c; return 0; } 程序的输出结果是A.1312B.132C.32D.1412
有如下程序:include using namespace std;class AA{ int n;public: AA(int k):n (k) 有如下程序: #include <iostream> using namespace std; class AA{ int n; public: AA(int k):n (k) { } int get(){return n; } int get()const{return n+1;} } int main() { AA a(5); const AA b(6); cout<<a.get()<<b.get(); return 0; } 执行后的输出结果是( )。A.55B.57C.75D.77