- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
面向對象程序设计C双语
第 PAGE 16 页 共 NUMPAGES 16 页
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 couta‘,’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 mode computation 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.
三、Complete the program (3*5’=15’) (Every question is 5 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...
Please complete the program.
#include iostream.h
void main()
{
demo d;
d.show();
demo d1(3,5);
d1.show();
demo d2(d1);
d2.show();
}
class demo{
int x, y;
public:
demo(int x=0,int y=0){x=a; y=b;}
demo(*d) {
x=d.x;
y=d.y;
}
~demo() { Destructor is called...
}
void show()
{
cout”x=”x”;y=”y;
}
};
2、#include iostream.h
#include string.h
class person{
char *Name;
int Age;
public:
person(char * name, int age);
~person();
char *GetName(){return Name;}
int GetAge(){return Age;}
void show();
};
person::person(char * name, int age){
①
②
Age=age;
}
perso
文档评论(0)