(31)有如下程序
#include
using namespace std;
Class Base{
public:
Base(int x=0):valB(x) {cout<
~Base() {cout<
private:
int valB;
};
class Derived:public Base{
public:
Derived(int x=0,int y=0):Base(x),valD(y){cout<
~Derived() {cout<
private:
int valD;
};
int main(){
Derived obj12(2,3);
retuen 0;
}
運行時的輸出結(jié)果是
A)2332
B)2323
C)3232
D)3223
(32)下面是類Shape的定義:
class Shape{
public:
virtual void Draw()=0;
};
下列關于Shape類的描述中,正確的是
A)類Shape是虛基類
B)類Shape是抽象類
C)類Shape中的Draw函數(shù)聲明有誤
D)語句“Shape s;”能夠建立Shape的一個對象s
(33)將運算符“+”重載為非成員函數(shù),下列原型聲明中,錯誤的是
A)MyClock operator + (MyClock,long);
B)MyClock operator + (MyClock,MyClock);
C)MyClock operator + (long,long);
D)MyClock operator + (long,MyClock);
(34)打開文件時可單獨或組合使用下列文件打開模式
①ios_base::app ②ios_base::binary
�、踚os_base::in ④ios_base::out
若要以二進制讀方式打開一個文件,需使用的文件打開模式為
A)①③
B)①④
C)②③
D)②④
(35)有如下程序:
#include
using namespace std;
Class B{
public:
B(int xx):x(xx) {++cout; x+=10;}
virtual void show() const
{cout<
protected:
static int count;
private:
int x;
};
class D:public B{
public:
D(int xx,int yy):B(xx),y(yy) {++count; y+=100;}
virtual void show() const
{cout<
private:
int y;
};
int B::count=0;
int main(){
B *ptr=new D(10,20);
ptr->show();
delete ptr;
return 0;
}
運行時的輸出結(jié)果是
A)1_120
B)2_120
C)1_20
D)2_20
北京 | 天津 | 上海 | 江蘇 | 山東 |
安徽 | 浙江 | 江西 | 福建 | 深圳 |
廣東 | 河北 | 湖南 | 廣西 | 河南 |
海南 | 湖北 | 四川 | 重慶 | 云南 |
貴州 | 西藏 | 新疆 | 陜西 | 山西 |
寧夏 | 甘肅 | 青海 | 遼寧 | 吉林 |
黑龍江 | 內(nèi)蒙古 |