- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
Object-Oriented Programming 计算机科学与技术学院 刘培强 liupq@126.com Chapter2 From C to C++ 2.1 Namespaces 名字空间 Namespaces - functions A namespace is a scope. C++ provides namespaces to prevent name conflicts. Namespaces - functions A namespace is a mechanism for expressing logical grouping. That is, if some declarations logically belong together to some criteria(准则), they can be put in a common namespace to express that fact. That is, the namespace is the mechanism for supporting module programming paradigm(范型). 同一 namespace 中的声明在概念上属于同一个逻辑实体。 Namespaces - functions Namespaces – scope resolution operator The scope resolution operator (域解析符):: occurs between the namespaces name and the variable. Namespaces – using declaration 由于各个 namespace 之间经常会出现互相使用对方成员的情况,如果一使用就要约束,既繁琐又容易出错。因此,C++提供了几种“有限的统一”约束的机制。 A using declaration(using声明) applies a single item in the namespace. Namespaces – using directive Using directive(using 指示)is equivalent to a using declaration for each item in a namespace. A using-directive makes names from a namespace available almost as if they had been declared outside their namespace. Namespaces – using directive A namespace is a scope. Thus, “namespace is a very fundamental and relatively simple concept. The larger a program is, the more useful namespaces are to express logical separations of its parts. Ideally(理想地), a namespace should [1] express a logically coherent (相关的) set of features. [2] not give users access to unrelated features, and [3] not impose a significant notational burden on users. Namespaces - std C++’s std namespaces includes all of the standard libraries. 2.2 Introduction to C++ Input/Output C++ Input/Output basic concepts In C++, input/output is treated as a stream of consecutive bytes(连续的字节流). Thus C++ input/output is called stream input/output. C++ Input/Output basic concepts The header iostream must be included to use C++ standard input/output. cin: the standard input object cout: the standard output object
您可能关注的文档
最近下载
- -钢结构厂房施工组织设计方案.doc VIP
- 最新易制毒(剧毒)化学品出入库、领使用登记台账.doc VIP
- 新课标小学体育水平三全册教案.doc VIP
- 湖北省武汉市十一初级中学2024-2025学年七年级上学期10月月考英语试卷(含答案,无听力音频听力原文).pdf VIP
- 《“探界者”钟扬》精品教案精品教案.doc VIP
- 知识点汇总_古代汉语.pdf VIP
- 活动执行质量保障措施方案.pdf VIP
- 2024年新课标人教版小学体育水平三全册教案.docx
- 2025年注册安全工程师《法律法规》30个必考点终极预测与高仿真模拟题库.pdf
- 2024-2025学年初中数学六年级上册(2024)鲁教版(五四学制)(2024)教学设计合集.docx
文档评论(0)