全国2006年10月高等教育自学考试面向对象程序设计试题(7)

2020-12-12 22:52

全国2006年10月高等教育自学考试

void other(void);

cout<<"i a b c\n";

cout<<setw(5)<<i<<setw(5)<<a<<setw(5)<<b<<setw(5)<<c<<endl;

c=c+8; other();

cout<<setw(5)<<i<<setw(5)<<a<<setw(5)<<b<<setw(5)<<c<<endl;

i=i+10; other();

}

32.写出下面程序的输出结果。

#include <iostream.h>

class A

{

private:

int X,Y;

public:

A() {

X=Y=0;

cout<<"Default Constructor called."<<endl;

}

A(int xx,int yy) {

X=xx;Y=yy;

cout<< "Constructor called."<<endl;

}

~A() {

cout<<"Destructor called."<<endl;

}

};

void main()

{

A *p1=new A;

delete p1;

p1=new A(1,2);

delete p1;

}

33.写出下面程序的输出结果。

#include <iostream.h>

class A {

private: int a;

public:

void set( int x) { a = x; }

void show() { cout<<"a="<<a<<","; }

};

class B: public A {

private: int b;

public:

void set(int x=0) { A::set(x);b=x; }

void set(int x, int y) { A::set(x); b=y; }

void show() { A::show(); cout<<"b="<<b<<endl; }

};

════════════════════════════════════════════════════════════════════

- 本套试题共分8页,当前页是第7页-


全国2006年10月高等教育自学考试面向对象程序设计试题(7).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:英国文学史_复习资料大二英语专业必考

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: