有如下程序: #include <iostream> using namespace std; class A public: A: A(int i)X=i; B: void dispa( )cout<<x<<','; C: private: D: int x; E: ; F: class B:public A G: public: H: B(int i):A(i+10)x=i; I: void dispb( )dispa( );cout<<x<<endl; J: private: K: int x; L: ; M: int main( ) N: B b(2); O: b.dispb( ); P: return 0; Q: 程序的输出结果是 A) 10,2 R: B) 12,10 S: C) 12,2 T: D) 2,2
有如下程序: #include <iostream> using namespace std; class A public: A: A(int i)X=i; B: void dispa( )cout<<x<<','; C: private: D: int x; E: ; F: class B:public A G: public: H: B(int i):A(i+10)x=i; I: void dispb( )dispa( );cout<<x<<endl; J: private: K: int x; L: ; M: int main( ) N: B b(2); O: b.dispb( ); P: return 0; Q: 程序的输出结果是 A) 10,2 R: B) 12,10 S: C) 12,2 T: D) 2,2
若有以下程序: #include <iostream> using namespace std; class A public: A: A()A(int i)x1=i;void dispa()cout<<"x1="<<x1<<",";private: B: int x1; C: ; D: class B:public Apublic: E: B() F: B(int i):A(i+10)x2=i;void dispb()dispa(); G: cout<<"x2="<<x2<<endl;pnvate: H: int x2; I: ; J: int main()B b(2); K: b.dispb(); L: return 0;程序运行后的输出结果是( M: )。A. x1=10,x2=2 N: x1=12,x2=10 O: x1=12,x2=2 P: x1=2,x2=2
若有以下程序: #include <iostream> using namespace std; class A public: A: A()A(int i)x1=i;void dispa()cout<<"x1="<<x1<<",";private: B: int x1; C: ; D: class B:public Apublic: E: B() F: B(int i):A(i+10)x2=i;void dispb()dispa(); G: cout<<"x2="<<x2<<endl;pnvate: H: int x2; I: ; J: int main()B b(2); K: b.dispb(); L: return 0;程序运行后的输出结果是( M: )。A. x1=10,x2=2 N: x1=12,x2=10 O: x1=12,x2=2 P: x1=2,x2=2