登录
注册
欢迎来到在线题库搜索
作业考试题库搜索平台
搜索答案
网站首页
会员联系qq:84302438 (仅限VIP会员,周一到周五12:00-18:00)
智能AI论文生成
当前位置:在线题库搜索>
[单选题]有如下程序: #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; }程序的输出结果是的答案是什么?
问题:
[单选题]有如下程序: #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; }程序的输出结果是
B、1
C、1
D、1
参考答案: D
报错
相关题目:
若有如下程序: #include<i
有如下程序: #include <i
有如下程序: #include <i
下面程序的输出结果是( )。 #in
如下程序的输出结果是 #includ
相关内容
●
有下列程序: #include<iotream> Uing namepace td; Cla Amount{ int amount; public; Amount(int n=O):amount(n){} Int getAmount()cont{return amount;} Amount &operator+=(AmountA) {
●
有如下程序: #include<iotream> uing namepace td; cla MyCla{ public: MyCla(){++count;} ~MyCla(){--count;} tatic int getCount(){return count;} private: tatic int count; }; int MyCla::count=0; int main(){ MyCl
●
若有以下程序: #include <iotream> uing namepace td; cla point { private: int x, y; public: point ( ) { x=0; y=0; } void etpoint(int x1,int y1) { x=x1; y=y1;
●
有如下程序: #include<iotream> uing namepace td; cla DA{ int k; public: DA(int x=1):k(x){} ~DA(){cout<<k;} }; int main(){ DAd[]={DA(3),DA(3),DA(3)}; DA*p=new DA[2]; delete[]p; return(); } 这个程序的输出结果是( )。
●
有如下程序: #include <iotream> uing namepace td; Cla x { protected: int a; public: x() { a=1; } }; cla x1 : virtual public x { public: x1() { a+=1; cout<<
●
有如下程序: #include<iotream) uing namepace td; claBae{ public: Bae(int x=0){cout<<x;} }; Cla Derived:public Bae{ public: Derived(int x=0){cout<<x;} private: Bae Val; }; int main(){ Derived d(1); return
●
有如下程序: #include<iotream> uing namepace td; cla Bae{ public: Bae(int x=0){cout<<x;} }; cla Derived:public Bae{ public: Derived(int x=0){cout<<x;} private: Bae val; }; int main( ){ Derived d(1); return 0; } 程序的输出结果是
●
有如下程序: #include <iotream> uing namepace td; cla Bae { public: Bae(int x=0) { cout<<x; } } cla Derived: public Bae{ public: Derived(int x=0) { cout<<x; } private: Bae val; }; int main() { Derived d(1); return 0; }程序的输出结果是
●
有如下程序: #include <iotream> uing namepace td; cla AA { public: virtual void f() { cout<< "AA"; } }; cla BB : public AA { public: BB() { cout << "BB"; } }; cla
●
有如下程序: #include<iotream>#include<ioream> uing namepace td; cla BASE{ char c; public; BASE(char n):c(n){} virtual ~ BASE(){cout<<c;} }; cla DERIVED; public BASE{ char c; public: DERIVED (char n): BASE (n+1)
●
下列程序的输出结果为( )。 #include (iotream) uing namepace td; void main( ) char,a[ ] = { "hello" ," the" ," world" }; char * * pa = a: pa + +; cout << * pa << ENDL; }
●
有如下程序: #include<iotream> uing namepace td; Cla Tet { public: Tet() {n+=2;} ~Tet() {n-=3;} tatic int getNum() {return n;} private: tatic int n; }; int Tet::n=1; int main() { Tet*p=new Tet;