C++面向?qū)ο蟪绦蛟O(shè)計(jì)雙語(yǔ)教程(第3版)
定 價(jià):54 元
- 作者:劉嘉敏 等
- 出版時(shí)間:2019/8/1
- ISBN:9787121364549
- 出 版 社:電子工業(yè)出版社
- 中圖法分類:TP312.8
- 頁(yè)碼:276
- 紙張:
- 版次:01
- 開(kāi)本:16開(kāi)
本書在保持前兩版特色的基礎(chǔ)上,對(duì)部分章節(jié)內(nèi)容進(jìn)行了修改和補(bǔ)充。全書案例易懂、切合實(shí)際。本書共8章,圍繞面向?qū)ο蟪绦蛟O(shè)計(jì)中類和對(duì)象的作用,介紹標(biāo)準(zhǔn)C++中類與對(duì)象的定義和封裝、繼承、重載、多態(tài)、模板的概念及實(shí)現(xiàn)方法。本書用通俗易懂的英語(yǔ)描述其內(nèi)容,讓初學(xué)者了解面向?qū)ο蟪绦蛟O(shè)計(jì)的原文表達(dá);而且在各章節(jié)中的重要知識(shí)點(diǎn)和易混淆知識(shí)點(diǎn)處均有雙語(yǔ)注解,有助讀者掌握面向?qū)ο蟮某绦蛟O(shè)計(jì)方法。本書面向具有程序設(shè)計(jì)基礎(chǔ)的讀者,可作為高等院校計(jì)算機(jī)及相關(guān)專業(yè)的面向?qū)ο蟪绦蛟O(shè)計(jì)課程的雙語(yǔ)教材。
劉嘉敏,現(xiàn)為國(guó)際SCI期刊論文評(píng)閱人。承擔(dān)計(jì)算機(jī)專業(yè)碩士研究生、本科生專業(yè)課和專業(yè)基礎(chǔ)課十多年,主持和參與遼寧省教和校級(jí)教改項(xiàng)目,獲了省教改項(xiàng)目二等獎(jiǎng),并發(fā)表數(shù)篇教改論文。出版了全英文撰寫的《C++面向?qū)ο蟪绦蛟O(shè)計(jì)雙語(yǔ)教程》教材。數(shù)年從事布局優(yōu)化、計(jì)算機(jī)圖形學(xué)與虛擬現(xiàn)實(shí)的研究,曾主持和參與10多項(xiàng)遼寧省科技廳、省教育廳、市科委及地方企業(yè)的科研項(xiàng)目,并在國(guó)內(nèi)外重要及核心期刊和國(guó)際會(huì)議發(fā)表學(xué)術(shù)論文30余篇,數(shù)篇論文被SCI和EI檢索。
Contents
Chapter 1 Introduction 1
1.1 Overview of Programming 1
1.1.1 What Is Programming? 1
1.1.2 How to Write a Program? 3
1.2 Programming Methodologies 5
1.2.1 Structured Programming 5
1.2.2 Object-Oriented Programming 8
1.3 Characteristics of Object-Oriented Programming 10
1.4 C++ Programming Language 13
1.4.1 History of C and C++ 13
1.4.2 Learning C++ 15
Word Tips 16
Exercises 17
Chapter 2 Basic Facilities — Shifting from C to C++ Programs 18
2.1 C++ Program Structure 18
2.2 Input/Output Streams 21
2.2.1 Input Stream 21
2.2.2 Output Stream 22
2.3 Constants 23
2.4 Functions 25
2.4.1 Function Declarations 25
2.4.2 Function Definitions 26
2.4.3 Default Arguments 28
2.4.4 Inline Functions 30
2.4.5 Function Overloading 30
2.5 References 35
2.5.1 Reference Definition 35
2.5.2 Reference Variables as Parameters 39
2.5.3 References as Returning Values 40
2.5.4 Reference as Left-Hand Values 42
2.6 Namespaces 43
Word Tips 47
Exercises 48
Chapter 3 Foundation of Classes and Objects—Data Abstraction and Definition
of Classes 52
3.1 Introduction to Structures 52
3.1.1 Defining a Structure in C++ 52
3.1.2 Accessing Members of Structures 53
3.1.3 Structures with Member Functions 55
3.2 Data Abstraction and Classes 56
3.2.1 Data Abstraction 56
3.2.2 Defining Classes 57
3.2.3 Defining Objects 58
3.2.4 Accessing Member Functions 59
3.2.5 In-Class Member Function Definition 61
3.2.6 File Structure of an Abstract Data Type 63
3.3 Information Hiding 65
3.4 Access Control 66
3.5 Constructors 69
3.5.1 Definition of Constructors 69
3.5.2 Overloading Constructors 70
3.5.3 Constructors with Default Parameters 71
3.6 Destructors 74
3.6.1 Definition of Destructors 74
3.6.2 UML Diagram for Classes 75
3.6.3 The Order of Constructor and Destructor Calls 76
3.7 Encapsulation 78
3.8 Case Study: A GradeBook Class 79
Word Tips 82
Exercises 83
Chapter 4 Advance of Classes and Objects —Further Definition of Class Members
and Objects 87
4.1 Constant Member Functions and Constant Objects 87
4.2 this Pointers 89
4.3 Static Members 91
4.3.1 Static Data Members 93
4.3.2 Static Member Functions 96
4.4 Free Store 97
4.5 Object Members 101
4.5.1 Definition of Object Members 101
4.5.2 The Order of Constructors and Destructors for Member Objects 105
4.5.3 Object Members with Default Constructors 105
4.5.4 Class Members by Using Initializers 106
4.6 Copy Members 107
4.6.1 Definition of Copy Constructors 108
4.6.2 Shallow Copy and Deep Copy 110
4.7 Arrays of Objects 118
4.7.1 Initialize an Object Array by Using a Default Constructor 118
4.7.2 Initialize an Object Array by Using Constructors with Parameters 121
4.8 Friends 122
4.8.1 Friend Functions 122
4.8.2 Friend Classes 125
4.9 Case Study: Advance of the GradeBook Class 126
Word Tips 132
Exercises 132
Chapter 5 Operator Overloading 137
5.1 Introduction to Operator Overloading 137
5.2 Operator Functions 138
5.2.1 Overloaded Operators 138
5.2.2 Operator Functions 138
5.3 Binary and Unary Operators 142
5.3.1 Overloading Binary Operators 142
5.3.2 Overloading Unary Operators 143
5.4 Overloading Combinatorial Operators 147
5.5 Mixed Arithmetic of User-Defined Types 151
5.6 Type Conversion of User-Defined Types 152
5.6.1 Converting a Built-In Type to a User-Defined Type 152
5.6.2 Converting User-Defined Types to Built-In Types 153
5.7 Case Study: A MyInteger Class 155
Word Tips 160
Exercises 160
Chapter 6 Inheritance 163
6.1 Class Hierarchies 163
6.2 Derived Classes 164
6.2.1 Declaration of Derived Classes 164
6.2.2 Structure of Derived Classes 165
6.3 Constructors and Destructors of Derived Classes 168
6.3.1 Constructors of Derived Classes 168
6.3.2 Destructors of Derived Classes 171
6.3.3 The Calling Order of Derived Class Objects 172
6.3.4 Inheritance and Composition 175
6.4 Member Functions of Derived Classes 175
6.4.1 Defining a Member Function 175
6.4.2 Overriding Member Functions 177
6.5 Access Control 179
6.5.1 Access Control in Classes 179
6.5.2 Access to Base Classes 180
6.6 Multiple Inheritance 184
6.6.1 Declaration of Multiple Inheritance 185
6.6.2 Constructors of Multiple Inheritance 187
6.7 Virtual Inheritance 188
6.7.1 Multiple Inheritance Ambiguities 188
6.7.2 Trying to Solve Inheritance Ambiguities 189
6.7.3 Virtual Base Classes 191
6.7.4 Constructing Objects of Multiple Inheritance 194
6.8 Case Study: The iWatch Class 195
Word Tips 201
Exercises 202
Chapter 7 Polymorphism and Virtual Functions 212
7.1 Polymorphism 212
7.1.1 Introduction to Polymorphism 212
7.1.2 Binding 213
7.2 Virtual Functions 216
7.2.1 Definition of Virtual Functions 216
7.2.2 Extensibility 219
7.2.3 Principle of Virtual Functions 221
7.2.4 Virtual Destructors 223
7.2.5 Function Overloading and Function Overriding 224
7.3 Abstract Base Classes 227
7.4 Case Study: A Mini System 230
Word Tips 235
Exercises 235
Chapter 8 Templates 241
8.1 Introduction to Templates 241
8.2 Function Templates 242
8.2.1 Definition of Function Templates 242
8.2.2 Function Template Instantiation 244
8.2.3 Function Template with Different Parameter Types 246
8.2.4 Function Template Overloading 247
8.3 Class Templates 248
8.3.1 Definition of Class Templates 248
8.3.2 Class Template Instantiation 251
8.4 Non-Type Parameters for Templates 253
8.5 Derivation and Class Templates 255
8.6 Case Study: A Vector Class Template 256
Word Tips 262
Exercises 262
References 264