单项选择题
有如下程序:
#include<iostream>
using namespace std;
class BASE
public:
~BASE()cout<<"BASE";)
;
class DERIVED:public BASE
public:
~DERIVED()cout<<"DERIVED";
;
int main()DERIVED x;return 0;
执行后的输出结果是( )。
A.BASE
B.DERIVED
C.BASEDERIVED
D.DERIVEDBASE
点击查看答案&解析
<上一题
目录
下一题>
热门
试题
单项选择题
下列程序的输出结果是( )。 #include<iostream.h> void main() char *str= 12123434 ; int x1=0,x2=0,x3=0,x4=0,i; for(i=0;str[i]!=’ 0’;i++) switch(str[i]) case’1’:x4++; case’2’:x3++; case’3’:x2++; case’4’:x1++; cout<<x1<< , <<x2<< , <<x3<< , <<x4;
A.8,6,4,1
B.8,6,3,2
C.8,8,4,1
D.8,6,4,2
点击查看答案&解析
单项选择题
有以下程序: #include<iostream> using namespace std; class A private: int a; public: A(int i) a=i; void disp() cout<<a<< , ;; class B private: int b; public: B(int j) b=j; void disp() cout<<b<< , ;; class C:public B,public A private: int c; public: c(int k):A(k-2),B(k+2) c=k; void disp() a::disp(); B::disp(); cout<<c<<endl; ; int main() C obj(10); obj.disp(); return 0; 程序执行后的输出结果是( )。
A.10,10,10
B.10,12,14
C.8,10,12
D.8,12,10
点击查看答案&解析
相关试题
下列程序将x、y和z按从小到大的顺序排列,...
operator是运算符重载时必须使用的关键字,...
下列程序完成从文件读取、文件显示的同时写...
在下面横线上填写适当的语句,完成程序。 ...
请在下列程序中的横线处填写正确的语句。 ...