1 / 16
文档名称:

面向对象程序设计C++双语(精选).doc

格式:doc   页数:16页
下载后只包含 1 个 DOC 格式的文档,没有任何的图纸或源代码,查看文件列表

如果您已付费下载过本站文档,您可以点这里二次下载

分享

预览

面向对象程序设计C++双语(精选).doc

上传人:bitu3331311 2015/9/18 文件大小:0 KB

下载得到文件列表

面向对象程序设计C++双语(精选).doc

文档介绍

文档介绍:12、For static member data, it is initialized at(b).
Before the declaration of class and after the main function
Before the main function and after the declaration of class
In the class
In the main function
二、Judgment, if it is right please √otherwise ×. (Every question is 2 point, total is 18 point)
1、C++ is a sub-set of C, it reserves almost all the characteristics of C.----------
2、Given int a; int &b=a; a=10; b=20; if cout<<a<<‘,’<<b; the result is: 20,20.--------
3、Given class AB, the copy constructor can be defined as: AB::AB(const AB &).---------
4、Both constructor and destructor can not be overloaded.---------
5、If class B is a friend of class A, then all member functions of class B can access the members in class A, vice versa.-----------
6、For a non-member operator overloading function, a putation can de defined as: X operator%(X), where X is the name of a class.------------
7、No objects of an abstract base class can be instantiated.-------------
8、Given class B{ int x; /*…..*/}; we can define class D: public B{ int z; public: void SetXZ( int a, int c) { x=a; z=c;} int Sun() { return x+z;}};------------
9、Object of a base class can be treated as an object of the derived class.------------
plete the program (3*5’=15’) (Every question is 5 point, total is 15 point)
(attention: one line for just one sentence)
1、After the main function, the result is:
x=0;y=0
x=3;y=5
x=3;y=5
Destructor is called...
Destructor is called...
Destructor is called...
plete the program.
#include <>
void main()
{
demo d;
();
demo d1(3,5);
();
demo d2(d1);
();
}
class demo{
int x, y;
public:
------demo(int x=0,int y=0)-----{x=a; y=b;}
---------demo(*d)------- {
x=;
y=;
}
------~demo()-------- {----- Destructor is called...
-----}
void show()
{
-------------cout<<”x=”<<x<<”;y=”<<y;---------------
}
};
2、#include <>
#include <>
class person{
char *Name;
int Age