c、c++概念性面试(C and c++ conceptual interview).doc

c、c++概念性面试(C and c++ conceptual interview).doc

  1. 1、本文档共14页,可阅读全部内容。
  2. 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
c、c概念性面试(Candcconceptualinterview)

c、c++概念性面试(C and c++ conceptual interview) 1. what is the difference between a pointer and a reference? If a reference is safer than a pointer, why? Wouldnt it be okay if I used const pointers? (1) references must be initialized when they are created; and pointers do not have to be initialized at the time they are defined (2) there is no null reference; the reference must be associated with the legal storage unit; the pointer can be NULL. (3) once a reference is initialized, the point cannot be changed; the pointer can change the point at any time. Assigning the reference does not change its binding relation to the original object (4) the creation and destruction of the reference does not call the copy constructor of the class (5) at the language level, the reference is the same as the object; on the binary level, references are generally implemented by pointers, but the compiler helps us complete the conversion There is no null reference, and the reference is safe once it is initialized to point to an object, and it cannot be changed to a reference to another object. The const pointer still has an empty pointer and is likely to generate wild pointers Generally speaking, reference has both the efficiency of pointer and the convenience and intuition of variable usage There are several ways to pass the 2. parameter; what is the way to implement polymorphic parameter passing? Pass a value, pointer, or reference Pass a pointer or reference What are the differences between the 3. C++ and the C definition structures?. Cs structure is only a combination of data, C++s struct and class actually have almost the same function, but the default access attributes are different. C structure can not be placed function, C++ structure can be. Defining the structure variable in C requires the struct keyword, and C++ does not. (in fact, the structure in C can be implemented based on objects and can be implemented by defining function pointers in the structure) The 4. constructor will b

您可能关注的文档

文档评论(0)

f8r9t5c + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

版权声明书
用户编号:8000054077000003

1亿VIP精品文档

相关文档