C++面向对象程序设计双语教程
2013-2
刘嘉敏、马广焜、常燕、 朱世铁 国防工业出版社 (2013-02出版)
《普通高等院校"十二五"规划教材:C++面向对象程序设计双语教程》作者结合多年的教学和实践经验,精心设计并编写了书中内容。书中从面向对象程序设计的特点出发,分章节循序渐进地介绍了面向对象的相关概念及运用C++实现的过程。书中在各个章节起始处提出学习的目标,重要知识点和易混淆知识点处均有重点注解和思考题,例题配有完整的程序代码和运行结果,每章末尾有重要的词汇注解和相应的练习题,有助于读者理解书中内容,帮助读者掌握面向对象编程方法。《普通高等院校"十二五"规划教材:C++面向对象程序设计双语教程》共分8章,围绕面向对象程序设计中对象的作用,介绍了C++进行面向对象程序设计的类定义和封装、继承、重载及多态等的实现过程和C++中泛型程序设计的模板基础知识。
Chapter 1 Introduction 1.1 Overview of Programming 1.1.1 What Is Programming? 1.1.2 How Do We Write a Program? 1.2 The Evolution of Programming Language 1.2.1 Assembly and Machine Languages 1.2.2 Early Languages 1.2.3 Later-Generation Languages 1.2.4 Modern Languages 1.3 Programming Methodologies 1.3.1 Structured Programming 1.3.2 Object-Oriented Programming 1.4 Object-Oriented Programming 1.5 C++ Programming Language 1.5.1 History ofC and C++ 1.5.2 Learning C++ Word Tips Exercises Chapter 2 Basic Facilities 2.1 C++ Program Structure 2.2 Input / Output Streams 2.3 Constant 2.4 Functions 2.4.1 Function Declarations 2.4.2 Function Definitions 2.4.3 Default Parameters 2.4.4 Inline Functions 2.4.5 Overloaded Functions 2.5 References 2.5.1 Reference Definition 2.5.2 Reference Variables as Parameters 2.5.3 References as Value-Returning 2.5.4 References as Left-Hand Values 2.6 Namespaces Word Tips Exercises Chapter 3 Classes and Objects (Ⅰ) 3.1 Structures 3.1.1 Defining a Structure 3.1.2 Accessing Members of Structures 3.1.3 Structures with Member Functions 3.2 Data Abstraction and Classes 3.2.1 Data Abstraction 3.2.2 Defining Classes 3.2.3 Defining Objects 3.2.4 Using Member Functions 3.2.5 In-Class Member Function Definition 3.2.6 File Structure of an Abstract Data Type 3.3 Information Hiding 3.4 Access Control 3.5 Constructors 3.5.1 Overloading Constructors 3.5.2 Constructors with Default Parameters 3.6 Destructors 3.6.1 Definition of Destructors 3.6.2 Order of Constructor and Destructor Calls Word Tips Exercises Chapter 4 Classes and Objects (Ⅱ) 4.1 Constant Members 4.2 this Pointers 4.3 Static Members 4.4 Free Store 4.5 Objects as Members of A Class 4.6 Copy Members 4.6.1 Definition of Copy Constructors 4.6.2 Shallow Copy and Deep Copy 4.7 Arrays of Objects 4.8 Friends 4.8.1 Friend Functions 4.8.2 Friend Classes 4.9 Examples of User-Defined Types Word Tips Exercises Chapter 5 Operator Overloading 5.1 Why Operator Overloading Is Need 5.2 Operator Functions 5.2.1 Overloaded Operators 5.2.2 Operator Functions 5.3 Binary and Unary Operators 5.3.1 Overloading Binary Operators 5.3.2 Overloading Unary Operators 5.4 Overloading Combinatorial Operators 5.5 Mixed Arithmetic of User-Defined Types 5.6 Type Conversion of User-Defined Types 5.7 Examples of Operator Overloading 5.7.1 A Complex Number Class 5.7.2 A String Class Word Tips Exercises Chapter 6 Inheritance 6.1 Class Hierarchies 6.2 Derived Classes 6.2.1 Declaration of Derived Classes 6.2.2 Structure of Derived Classes 6.3 Constructors and Destructors of Derived Classes 6.3.1 Constructors of Derived Classes 6.3.2 Destructors of Derived Classes 6.3.3 Order of Calling Class Objects 6.3.4 Inheritance and Composition 6.4 Member Functions of Derived Classes 6.5 Access Control 6.5.1 Access Control in A Class 6.5.2 Access to Base Classes 6.6 Multiple Inheritance 6.6.1 Declaration of Multiple Inheritance 6.6.2 Constructors of Multiple Inheritance 6.7 Virtual Inheritance 6.7.1 Multiple Inheritance Ambiguities 6.7.2 Trying to Solve Inheritance Ambiguities 6.7.3 Virtual Base Classes 6.7.4 Constructing Objects of Multiple Inheritance Word Tips Exercises Chapter 7 Polymorphism and Virtual Functions 7.1 Polymorphism 7.1.1 Concept of Polymorphism 7.1.2 Binding 7.2 Virtual Functions 7.2.1 Definition of Vitual Functions 7.2.2 Extensibility 7.2.3 Principle of Virtual Functions 7.2.4 Virtual Destructors 7.2.5 Function Overloading and Function Overriding 7.3 Abstract Base Classes Word Tips Exercises Chapter 8 Templates 8.1 Templates Mechanism 8.2 Function Templates and Template Functions 8.2.1 Why We Use Function Templates? 8.2.2 Definition of Function Templates 8.2.3 Function Template Instantiation 8.2.4 Function Template with Different Parameter Types 8.2.5 Function Template Overloading 8.3 Class Templates and Template Classes 8.3.1 Definition of Class Templates 8.3.2 Class Template Instantiation 8.4 Non-Type Parameters for Templates 8.5 Derivation and Class Templates Word Tips Exercises References
版权页: 插图: Chapter 6 Inheritance Do not multiply objects without necessity. --W.Occam Objectives To create classes by inheriting from existing classes The use of constructors and destructors in inheritance hierarchies Access control in the class and the differences between public,protected and private inheritance To understand multiple inheritance To avoid ambiguities with multiple inheritance To avoid ambiguities with virtual inheritance 6.1 Class Hierarchies In the previous chapters,we discuss how to build a single class that is a representation of real objects.The class is represented by a collection of abstracted concepts with common characteristics.However,a concept does not exist in isolation always.It coexists with related concepts and derives much of its power from relationships with related concepts.It is a fundamental aspect of human intelligence to seek out,recognize,and create relationships among concepts. For example,the concepts of a circle,a triangle and a rectangle are related in that they are both shapes; that is,they have the concept of a shape in common,that is,they have the operations of move,draw and calculation.However,we find their difference points of the circle,triangle and rectangle.Thus,we must explicitly define classes Circle,Triangle and Rectangle to have class Shape in common.Representing a circle,a triangle and a rectangle in a program without involving the notion of a shape would be to lose something essential.Each kind of shape is more specialized than its parent Shape? We can classify different kind of shape according to hierarchy shown in Figure 6-1.This could be represented in the world of classes with a class Shape from which we would derive the three other ones:Circle,Triangle and Rectangle.
《普通高等院校"十二五"规划教材:C++面向对象程序设计双语教程》以英语撰写,用通俗易懂的英语描述其内容,符合中国人的思维、语言习惯,既让初学者了解面向对象程序设计的原文表达,也便于对知识点的掌握。《普通高等院校"十二五"规划教材:C++面向对象程序设计双语教程》面向具有程序设计入门基础的读者,可作为高等院校计算机及相关专业的面向对象程序设计课程的双语教材,也可作为程序员和编程爱好者的参考书。