《面向对象程序设计》期末试卷及标准答案修订

loading 分享 2026-8-21 下载文档

1、

#include

using namespace std;

void fun(int &a, int &b)

{ int p;

p=a; a=b; b=p;

}

void exchange(int &a, int &b, int &c){ if( a

if( a

if( b

}

int main()

{ int a=12,b=89,c=56;

exchange(a, b, c);

cout<<\

return 0; a=89,b=56,c=12

}

2、

#include

using namespace std;

class A {

public:

A( ) { cout << \

};

class B {

public:

B( ) { cout <<\

};

class C: public A {

public:

C( ) { cout << \

Private:

B b;

};

int main ( ) { C obj; return 0; }

3、

ABC


《面向对象程序设计》期末试卷及标准答案修订.doc 将本文的Word文档下载到电脑