单项选择题
如下程序的输出是
#include<iostream>
using namespace std;
class Base
public:
Base( )cout<<"BB";f( );
void f( )cout<<"Bf";
;
class Derived:public Base
public:
Derived( )eout<<"DD";
void f( )cout<<"Df";
;
int main( )Derived d;return 0;
A.BBBff)D
B.BBDfDDDf
C.DD
D.DDBBBf
点击查看答案&解析
<上一题
目录
下一题>
热门
试题
单项选择题
有如下程序: #include<iostream> using namespace std; class Stack public: Stack(unsignedn=10):size(n)rep_=new int[size];top=0; Stack(Stack& s):size(s.size) rep_=new int[size]; fbr(inti=0;i<size;i++)rep_[i]=s.rep_[i]; top=s.top; ~Stack( )delete[ ]rep_; void push(int
A.rep一_top]=a;top++;
int pop( )--top;return rep_[top];
b001 isEmpty( )constreturn top==0;
private:
int * rep_;
unsigned size,top;
;
int main( )
Stack sl;
for(int i=1;i<5;i++)s1.push(i);
Stack s2(s1);
for(i=1;i<3;i++)cout<-<s2.pop( )<<’,’;
s2.pusl:(6);
s1.push(7);
while(!s2.isEmpty( ))cout<<s2.pop( )<<’,’;
return 0:
程序的输出结果是A) 4,3,2,1,
B.4,3,6,7,2,1,
C.4,3,6,2,1,
D.1,2,3,4,
点击查看答案&解析
单项选择题
在下面的定义语句中,画线处应填入的内容是 class Fred public: void print( )cout<<data<<endl; void setData(double D) data=d; static int count; private: double data; ; ______count=0; 静态数据成员的定义
A.int
B.static int
C.int Fred::
D.static int Fred::
点击查看答案&解析
相关试题
C++语言中的多态性分为编译时的多态性和...
有如下程序: #include<iostream> usi...
若将一个二元运算符重载为类的成员函数,其...
用来派生新类的类称为______,而派生...
有如下程序: #include<iostream> usi...