第一部分 基 础 编 程
Part Ⅰ The Basic Programming
第1章 概述(Introduction) 2
1.1 程序设计语言(Programming Language) 2
1.2 C++前史(The Prehistory of C++) 4
1.3 C++ 6
1.3.1 褒贬C(Pass Judgement on C) 6
1.3.2 C继承者(Inheritor of C) 7
1.3.3 标准C++(Standard C++) 7
1.4 C++编程流程(C++ Programming Flow) 8
1.4.1 编程过程(Programming Procedure) 8
1.4.2 最小样板程序(Minimum Sample Program) 9
1.4.3 编程风格(Programming Style) 10
1.5 程序与算法(Programs & Algorithms) 11
1.5.1 程序(Programs) 11
1.5.2 算法(Algorithms) 12
1.5.3 编程与结构(Programming & Structures) 13
1.6 过程化程序设计(Procedural Programming) 13
1.6.1 基于过程的程序设计(Procedure-Based Programming) 13
1.6.2 结构化程序设计(Structured Programming) 16
1.7 对象化程序设计(Objectified Programming) 18
1.7.1 基于对象的程序设计(Object-Based Programming) 18
1.7.2 面向对象的程序设计(Object-Oriented Programming) 20
1.8 目的归纳(Conclusion) 22
练习1(Exercises 1) 23
第2章 基本编程语句(Basic Programming Statements) 24
2.1 说明语句(Declarative Statements) 24
2.1.1 变量定义(Variable Definition) 25
2.1.2 函数声明和定义(Function Declaration & Definition) 26
2.1.3 初始化与赋值(Initializing & Assignment) 27
2.2 条件语句(Conditional Statements) 27
2.2.1 if语句(if Statement) 27
2.2.2 条件表达式(Conditional Expressions) 30
2.2.3 switch语句(switch Statement) 31
2.2.4 if或switch语句(if or switch Statement) 34
2.3 循环语句(Loop Statements) 35
2.3.1 for循环结构(for Loop Structure) 35
2.3.2 for循环(for Loop) 36
2.3.3 while循环(while Loop) 38
2.3.4 do-while循环(do-while Loop) 39
2.4 循环设计(Cycle Designs) 40
2.4.1 字符图形(Character Graphics) 40
2.4.2 素数判定(Prime Decision) 44
2.5 输入输出语句(I/O Statements) 46
2.5.1 标准I/O流(Standard I/O Streams) 46
2.5.2 流状态(Stream States) 46
2.5.3 文件流(File Streams) 49
2.6 转移语句(Move Statements) 51
2.6.1 break语句(break Statement) 51
2.6.2 continue语句(continue Statement) 52
2.6.3 goto语句(goto Statement) 53
2.7 再做循环设计(More Cycle Designs) 55
2.7.1 逻辑判断(Logic Decision) 55
2.7.2 级数逼近(Progression Approximation) 58
2.8 目的归纳(Conclusion) 61
练习2(Exercises 2) 62
第3章 数据类型(Data Types) 65
3.1 整型(int Types) 66
3.1.1 二进制补码(Binary Complement) 66
3.1.2 整型数表示范围(int Range) 68
3.1.3 编译器与整型长度(Compiler & int Length) 69
3.1.4 整数字面值(Integer Literals) 70
3.1.5 整数算术运算(Integer Arithmetic Operations) 70
3.2 整数子类(int Subtypes) 71
3.2.1 字符型(char Type) 71
3.2.2 枚举型(enum Type) 72
3.2.3 布尔型(bool Type) 73
3.3 浮点型(float Type) 73
3.3.1 浮点数表示(Floating-Point Number Representation) 74
3.3.2 浮点型表示范围 (Floating-PointType Ranges ) 77
3.4 C-串与string(C-strings & string) 78
3.4.1 C-串(C-strings) 78
3.4.2 字符指针与字符数组(char Pointers & char Arrays) 79
3.4.3 string 82
3.4.4 string与C-串的输入输出(string & C-string I/O) 84
3.4.5 string流(string Streams) 85
3.5 数组(Arrays) 86
3.5.1 元素个数(Number of Elements) 86
3.5.2 初始化(Initialization) 87
3.5.3 默认值(Default Values) 89
3.5.4 二维数组(2-D Arrays) 90
3.6 向量(Vectors) 90
3.6.1 基本操作(Basic Operations) 90
3.6.2 添加元素(Adding Elements) 92
3.6.3 二维向量(2-D Vectors) 93
3.7 指针与引用(Pointers & References) 94
3.7.1 指针(Pointers) 95
3.7.2 指针的类型(Pointer Types) 96
3.7.3 指针运算(Pointer Operations) 98
3.7.4 指针限定(Pointer Restrictions) 99
3.7.5 引用(References) 101
3.8 目的归纳(Conclusion) 102
练习3(Exercises 3) 103
第4章 计算表达(Computation Expressing) 105
4.1 名词解释与操作符(Name Explanation & Operators) 105
4.1.1 名词解释(Some Name Explanations) 105
4.1.2 操作符汇总(Operators Summary) 107
4.1.3 操作符的说明(Operator Explanations) 108
4.2 算术运算问题(Arithmetic Problems) 109
4.2.1 周而复始的整数(int: Move in Cycles) 109
4.2.2 算法局限性(Algorithm Limitation) 110
4.2.3 中间结果溢出(Intermediate Result Overflow) 111
4.2.4 浮点数的比较(Floating-Point Number Comparison) 112
4.3 相容类型的转换(Cast Compatible Types) 113
4.3.1 隐式转换(Implicit Cast) 113
4.3.2 精度丢失(Lost Precision) 114
4.3.3 显式转换(Explicit Cast) 115
4.4 关系与逻辑操作(Relations & Logic Operations) 117
4.4.1 条件表达(Condition Expressing) 118
4.4.2 基本逻辑与短路求值(Basic Logic & Short-Circuit Evaluation) 120
4.4.3 逻辑推演(Logic Inference & Deduction) 121
4.5 位操作(Bit Operations) 122
4.5.1 位操作种类(The Kinds of Bit Operations) 122
4.5.2 位操作实例(Bit Operation Example) 123
4.6 增量操作(Increment Operations) 125
4.6.1 增量操作符(Increment Operators) 125
4.6.2 操作符识别(Operator Recognition) 126
4.6.3 指针的增量操作(Pointer Increment Operation) 127
4.7 表达式的副作用(Expression’s Side Effects) 128
4.7.1 操作数求值顺序(Operands Evaluating Order) 128
4.7.2 编译器相关(Complier Correlated) 129
4.7.3 交换律失效(Commutation Law Invalidation) 130
4.7.4 括号失效(Bracket Invalidation) 130
4.7.5 消除副作用(Avoiding Side Effects) 131
4.8 目的归纳(Conclusion) 131
练习4(Exercises 4) 132
第二部分 过程化编程
Part Ⅱ The Procedural Programming
第5章 函数机制(Function Mechanism) 136
5.1 函数性质(Function Character) 137
5.1.1 函数的形态(The Function Forms) 137
5.1.2 函数黑盒(Function Blackbox) 138
5.1.3 传值参数(Value-Passed Parameters) 140
5.2 指针参数(Pointer Parameters) 141
5.2.1 指针和引用参数(Pointer & Reference Parameters) 141
5.2.2 函数的副作用(Function’s Side Effect) 145
5.3 栈机制(The Stack Mechanism) 147
5.3.1 运行时内存布局(Runtime Memory Layout) 147
5.3.2 栈区(The Stack Area) 148
5.3.3 局部数据的不确定性(Uncertainty of Local Data) 151
5.3.4 指针作祟(The Menacing Pointers) 151
5.4 函数指针(Function Pointers) 153
5.4.1 指向函数的指针(Function Pointers) 153
5.4.2 函数指针参数(Function Pointer Parameters) 155
5.4.3 函数指针数组(Function Pointer Arrays) 156
5.4.4 简略函数指针表示(The Outline of Function Pointers) 158
5.4.5 函数指针的意义(The Sense of Function Pointers) 158
5.5 main函数参数(The main’s Arguments) 159
5.5.1 命令行重定向(Redirecting Command Line) 159
5.5.2 使用main参数(Using Main Arguments) 161
5.6 递归函数(Recursive Functions) 164
5.6.1 递归本质(Essence of Recursions) 164
5.6.2 递归条件(Condition of Recursions) 165
5.6.3 消去递归(Removing Recursions) 166
5.6.4 递归评说(Comment on Recursions) 167
5.7 函数重载(Function Overloading) 167
5.7.1 重载概念(Concept of Function Overload) 167
5.7.2 重载函数匹配(Overloaded Function Call Matches) 170
5.7.3 重载技术(Function Overload Technology) 171
5.7.4 默认参数(Default Parameters) 171
5.7.5 默认参数规则(Default Parameter Rules) 172
5.7.6 无名参数(Nameless Parameters) 173
5.7.7 重载或参数默认(Overload or Parameter Default) 173
5.8 目的归纳(Conclusion) 175
练习5(Exercises 5) 176
第6章 性能(Performance) 179
6.1 内联函数(Inline Functions) 180
6.1.1 概念(Concept) 180
6.1.2 规则(Rules) 182
6.1.3 性能测试(Performance Testing) 183
6.2 数据结构(Data Structures) 184
6.2.1 STL中的容器(Containers in STL) 184
6.2.2 安排车厢顺序(Arrange the Order of Coach) 185
6.2.3 栈法(Stack Method) 186
6.2.4 向量法(Vector Method) 187
6.3 算法(Algorithms) 188
6.3.1 算法与性能(Algorithms & Performance) 188
6.3.2 Fibonacci数列算法分析(Fib’s Algorithms Analyses) 189
6.3.3 选择算法(Selecting Algorithms) 191
6.3.4 超越数值范围的策略(Strategy that Exceeding Number Range) 193
6.4 数值计算(Numerical Computation) 194
6.4.1 求解积分问题(Solve the Integral Problems) 194
6.4.2 矩形法(Rectangle Method) 194
6.4.3 辛普生法(Simpson Method) 196
6.4.4 调用库函数(Calling for the Library Function) 198
6.5 标准C++算法(Standard C++ Algorithms) 199
6.5.1 集合元素访问(Element Access of Set) 199
6.5.2 判断字串相等1(Determining the String is Equal 1) 199
6.5.3 判断字串相等2(Determining the String is Equal 2) 200
6.5.4 判断字串相等3(Determining the String is Equal 3) 201
6.5.5 剩余串排列1(Arranging Remaining String 1) 202
6.5.6 剩余串排列2(Arranging Remaining String 2) 203
6.6 动态内存(Dynamic Memory) 204
6.6.1 预留向量空间(Reserving Vector Space) 204
6.6.2 蛮做素数判断(Judging Prime Numbers Rudely) 205
6.6.3 空间换时间(Space for Time) 206
6.7 低级编程(Low-Level Programming) 208
6.7.1 C编程(C Programming) 208
6.7.2 低级筛法(Low-Grade Sieve) 209
6.7.3 筛法性能的比较(Comparison of Sieve Performance) 211
6.8 目的归纳(Conclusion) 213
练习6(Exercises 6) 214
第7章 程序结构(Program Structure) 219
7.1 函数组织(Function Organization) 220
7.1.1 程序构成(Program Composition) 220
7.1.2 程序文件拆分(Program File Split) 221
7.2 头文件(Header File) 222
7.2.1 原始头文件(Original Header File) 222
7.2.2 界面头文件(Interface Header File) 224
7.2.3 头文件的内容(Content of Header File) 225
7.3 全局数据(Global Data) 226
7.3.1 全局数据访问(Global Data Access) 226
7.3.2 消除全局数据(Eliminate Global Data) 228
7.3.3 一次定义原则(One-Definition Principle) 229
7.3.4 全局常量(Global Constant) 232
7.4 静态数据(Static Data) 234
7.4.1 静态全局数据(Static Global Data) 234
7.4.2 静态局部数据(Static Local Data) 236
7.5 作用域与生命期(Scopes & Lifetime) 237
7.5.1 作用域(Scopes) 237
7.5.2 生命期(Lifetime) 239
7.6 名空间(Namespace) 241
7.6.1 名空间的概念(the Concept of Namespace) 241
7.6.2 名空间的组织(Namespace Organization) 242
7.6.3 组织模块(Module Organization) 244
7.6.4 数据名冲突(Data Name Conflict) 247
7.6.5 名空间的用法(Namespace Usage) 248
7.7 预编译(Pre-Compilation) 249
7.7.1 #include指令(#include Directive) 250
7.7.2 条件编译指令(Conditional Compiling Directive) 250
7.7.3 头文件卫士(Header Guard) 251
7.7.4 #define指令(#define Directive) 252
7.8 目的归纳(Conclusion) 253
练习7(Exercises 7) 253
第三部分 面向对象编程技术
Part Ⅲ The Object-Oriented Programming
第8章 类(Classes) 258
8.1 从结构到类(From Structure to Class) 259
8.1.1 定义结构(Defining Structure) 259
8.1.2 定义类(Defining Class) 261
8.2 成员函数(Member Functions) 263
8.2.1 成员函数定义(Member Function Definition) 263
8.2.2 使用对象指针(Using Object Pointer) 265
8.2.3 常成员函数(Constant Member Functions) 266
8.2.4 重载成员函数(Overloading Member Functions) 267
8.3 操作符(Operators) 268
8.3.1 函数重载特征(Function Overloading Charcteristics) 268
8.3.2 性质(Characters) 270
8.3.3 值返回与引用返回(Returning Value or Reference) 271
8.3.4 增量操作符(Increment Operators) 272
8.3.5 成员操作符(Member Operators) 273
8.4 再论程序结构(Revisiting Program Structure) 275
8.4.1 访问控制(Access Controls) 275
8.4.2 类的程序结构(Class Program Structure) 277
8.4.3 类作用域(Class Scope) 278
8.5 屏蔽类的实现(Shielding Implementation of Class) 280
8.5.1 意义(Significance) 280
8.5.2 影响编程方法(Influence Programming Method) 283
8.5.3 影响语言设计(Affecting Language Designing) 283
8.6 静态成员(Static Members) 284
8.6.1 静态数据成员(Static Data Members) 284
8.6.2 静态成员函数(Static Member Functions) 286
8.7 友元(Friends) 287
8.7.1 频繁调用问题(Frequent Call Problems) 287
8.7.2 提高访问性能(Improving Access Performance) 290
8.7.3 其他特征(Other Features) 293
8.8 目的归纳(Conclusion) 294
练习8(Exercises 8) 295
第9章 对象生灭(Object Birth & Death) 299
9.1 构造函数设计(Constructor Design) 300
9.1.1 初始化要求(Initialization Requirement) 300
9.1.2 封装性要求(Encapsulation Requirement) 301
9.1.3 函数形式(Function Form) 301
9.1.4 无返回值(Non Return-Type) 302
9.1.5 set的缺憾(Shortcomings of set) 304
9.1.6 一次性对象(Only-One-Time Object) 306
9.2 构造函数的重载(Overloading of the Constructor) 306
9.2.1 重载构造函数(Overloaded Constructor) 306
9.2.2 无参构造函数(Non-Parameter Constructor) 309
9.3 类成员初始化(Class Member Initialization) 310
9.3.1 默认调用的无参构造函数(No-Argument Constructor Called
by Default) 310
9.3.2 初始化的困惑(Initialization Confusion) 311
9.3.3 成员的初始化(Initializing Members) 313
9.4 构造顺序(Constructing Sequence) 314
9.4.1 局部对象(Local Objects) 314
9.4.2 全局对象(Global Objects) 315
9.4.3 成员对象(Member Objects) 317
9.4.4 构造位置(Constructing Location) 318
9.5 拷贝构造函数(Copy Constructor) 319
9.5.1 对象本体与实体(Object Realty & Entity) 319
9.5.2 默认拷贝构造函数(Default Copy Constructor) 321
9.5.3 自定义拷贝构造函数(Custom Copy Constructor) 322
9.6 析构函数(Destructors) 324
9.7 对象转型与赋值(Object Transformation & Assignment) 326
9.7.1 用于转型的构造函数(Constructor for Transformation) 326
9.7.2 对象赋值(Object Assignment) 327
9.8 目的归纳(Conclusion) 330
练习9(Exercises 9) 331
第10章 继承(Inheritance) 334
10.1 继承结构(Inheritance Structure) 335
10.1.1 类层次结构(Class Hierarchy) 335
10.1.2 派生类对象结构(Derived Object Structure) 336
10.2 访问父类成员(Access Parent Member) 337
10.2.1 继承父类成员(Inherit the Members of the Parent Class) 337
10.2.2 类内访问控制(In-Class Access Control) 339
10.3 派生类的构造(Constructing Derived Classes) 341
10.3.1 默认构造(Default Construction) 341
10.3.2 自定义构造(Custom Construction) 341
10.3.3 拷贝构造与赋值(Copy Construction & Assignment) 343
10.3.4 对象构造顺序(Object Construction Order) 344
10.4 继承方式(Inheritance Mode) 344
10.4.1 继承访问控制(Inherited Access Control) 344
10.4.2 调整访问控制(Adjusting Access Control) 347
10.5 继承与组合(Inheritance & Composition) 348
10.5.1 对象结构(Object Structure) 348
10.5.2 性质差异(Difference in Nature) 349
10.5.3 对象分析(Object Analysis) 349
10.5.4 继承设计(Inheritance Design) 351
10.5.5 组合设计(Composition Design) 352
10.6 多继承概念(Multi-Inheritance Concept) 354
10.6.1 多继承结构(Multi-Inheritance Structure) 354
10.6.2 基类成员名冲突(Base-Class Member Name Collision) 356
10.6.3 基类分解(Base-Class Decomposition) 356
10.7 多继承技术(Multi-Inheritance Technology) 358
10.7.1 虚拟继承(Virtual Inheritance) 358
10.7.2 多继承对象构造顺序(Multi-Inheritance Object
Construction Order) 360
10.7.3 多继承评价(Multi-Inheritance Evaluation) 360
10.8 目的归纳(Conclusion) 360
练习10(Exercises 10) 361
第11章 基于对象编程(Object-Based Programming) 363
11.1 抽象编程(Abstract Programming) 364
11.1.1 行为抽象(Action Abstract) 364
11.1.2 数据抽象(Data Abstract) 365
11.1.3 数据结构(Data Structure) 366
11.2 编程质量(Programming Quality) 367
11.2.1 可读性(Readability) 367
11.2.2 易编程性(Programmability) 368
11.2.3 安全性(Security) 369
11.2.4 可维护性(Maintainability) 370
11.2.5 可扩充性(Extensibility) 370
11.2.6 效率(Efficiency) 370
11.3 分析Josephus问题(Analyze the Josephus Problem) 372
11.3.1 问题描述(Problem Description) 372
11.3.2 过程化分析(Process Analysis) 373
11.3.3 基于对象的分析(Object-Based Analysis) 374
11.4 基于过程的解决方案(Process-Based Solutions) 375
11.4.1 算法(The Algorithm) 375
11.4.2 算法解释(Algorithm Explanation) 376
11.4.3 算法实现(Algorithm Implementation) 377
11.5 基于对象的解决方案(Object-Based Solutions) 379
11.5.1 算法(The Algorithm) 379
11.5.2 算法解释(Algorithm Explanation) 381
11.5.3 算法实现(Algorithm Implementation) 382
11.5.4 程序解释(Program Explanation) 385
11.6 程序维护(Program Maintenance) 386
11.7 程序扩展(Program Extension) 388
11.8 目的归纳(Conclusion) 391
练习11(Exercises 11) 392
第四部分 高级编程
Part Ⅳ Advanced Programming
第12章 多态(Polymorphism) 396
12.1 继承召唤多态(Inheritance Call Polymorphism) 397
12.1.1 祖孙互易的说明(Explanation of Mutual Change Between
Up & Down) 397
12.1.2 覆盖父类操作(Overlapping Superclass Operation) 398
12.1.3 同化效应(Assimilation Effect) 399
12.1.4 渴望多态(Desire Polymorphism) 400
12.2 抽象编程的困惑(The Confusion of Abstract Programming) 401
12.2.1 类型域方案(Type Domain Scheme) 401
12.2.2 破坏抽象编程(Destroy Abstract Programming) 403
12.2.3 渴望内在的多态(Yearning for Inner Polymorphism) 404
12.3 虚函数(Virtual Function) 404
12.3.1 多态条件(Polymorphism Condition) 404
12.3.2 虚函数机理(Virtual Function Mechanism) 406
12.3.3 面向对象的真意(Object-Oriented True Meaning) 406
12.3.4 虚函数的传播(Propagation Virtual Functions) 407
12.4 避免虚函数误用(Avoiding Misuse of Virtual Functions) 408
12.4.1 搞清重载与覆盖(Understanding Overload & Overlap) 408
12.4.2 虚函数按覆盖实现(Virtual Function Realized as Overlap) 409
12.4.3 基类指针访问子类成员(Accessing SubClass’s Member
Using BaseClass Pointer) 411
12.4.4 返回类型的例外(Exception of Return Type) 412
12.4.5 若干限制(Some Restrictions) 413
12.5 精简共性的类(Streamline Common Classes) 414
12.5.1 孤立的类(Isolated Classes) 414
12.5.2 减少冗余代码(Reducing Redundant Code) 417
12.5.3 改变基类殃及子类(SubClass Suffered by Changing Base-Class) 420
12.6 多态编程(Polymorphic Programming) 420
12.6.1 共同基类方案(Common Base-Class Scheme) 420
12.6.2 自定义链表类(Custom Linked List Class) 425
12.6.3 表现多态(Performance Polymorphism) 426
12.7 类型转换(Type Conversions) 427
12.7.1 动态转型(dynamic_cast) 427
12.7.2 静态转型(static_cast) 429
12.7.3 常量转型(const_cast) 430
12.8 目的归纳(Conclusion) 431
练习12(Exercises 12) 432
第13章 抽象类(Abstract class) 434
13.1 抽象基类(Abstract Base-Class) 434
13.1.1 无意义的基类对象(Meaningless Base Objects) 434
13.1.2 纯虚函数(Pure Virtual Functions) 436
13.2 抽象类与具体类(Abstract & Concrete Classes) 437
13.3 深度隔离的界面(Deeply Isolated Interface) 439
13.3.1 日期的年月日版本(Year-Month-Day Version of the Date) 439
13.3.2 日期的天数版本(Day Version of the Date) 441
13.3.3 应用程序界面(Application Program Interface) 442
13.4 抽象类做界面(Abstract Class As Interface) 444
13.4.1 抽象基类方案(Abstract Base-Class Scheme) 445
13.4.2 抽象基类IDate(Abstract Base-Class IDate) 445
13.4.3 创建Date对象(Creating Date Objects) 446
13.4.4 子类Date(Subclass Date) 447
13.4.5 应用编程(Application Programming) 449
13.5 演绎概念设计(Deducting Concept Design) 450
13.5.1 面向对象的模块(Object-Oriented Module) 450
13.5.2 Sony类层次结构(Class Sony Hierarchy) 450
13.5.3 Sony类定义(Defining Class Sony) 452
13.5.4 CreateSony类层次结构(Class CreateSony Hierarchy) 456
13.5.5 CreateSony的子类定义(Defining CreateSony’s Sybclass) 458
13.5.6 应用编程(Application Programming) 460
13.6 系统扩展(System Extension) 461
13.6.1 新添一个界面(Adding a New Interface) 462
13.6.2 新添一种技术(Adding a New Technology) 464
13.7 手柄(Handles) 465
13.7.1 对象指针问题(Object Pointer Problem) 465
13.7.2 对象指针的外套(Object Pointer Coat) 466
13.7.3 可用的手柄类(Available Handles) 468
13.8 目的归纳(Conclusion) 469
练习13(Exercises 13) 470
第14章 模板(Templates) 471
14.1 函数模板(Function Templates) 472
14.1.1 函数重载的困惑(Confusion of Function Overloading) 472
14.1.2 函数模板的定义(Defining Function Template) 473
14.1.3 函数模板的用法(Usage of Function Templates) 473
14.2 函数模板参数(Function Template Parameters) 475
14.2.1 苛刻的类型匹配(Harsh Type Match) 475
14.2.2 数据形参(Data Arguments) 476
14.2.3 常量引用型形参(const Reference Arguments) 477
14.2.4 引用型形参(Reference Arguments) 478
14.2.5 函数模板重载(Function Template Overloading) 478
14.3 类模板(Class Templates) 480
14.3.1 容器类的困惑(Confusion of Container Classes) 480
14.3.2 类模板的定义(Class Template Definition) 481
14.3.3 类模板的实现(Class Template Implementation) 482
14.3.4 模板类和类模板(Template Classes & Class Templates) 484
14.3.5 模板值参数(Template Value Parameters) 485
14.3.6 默认模板实参(Default Template Arguments) 485
14.4 实例化与定做(Instantiation & Specialization) 486
14.4.1 模板实例化(Template Instantiation) 486
14.4.2 定做(Specialization) 487
14.4.3 局部定做(Partial Specialization) 490
14.5 程序组织(Program Organization) 491
14.5.1 包含方式(Inclusion Method) 491
14.5.2 分离方式(Separation Method) 494
14.6 模板的多态(Template Polymorphism) 496
14.6.1 动多态与静多态(Dynamic & Static Polymorphism) 496
14.6.2 动多态编程(Dynamic Polymorphism Programming) 496
14.6.3 静多态编程(Static Polymorphism Programming) 499
14.6.4 动静多态的差异(Difference between Dynamic & Static
Polymorphism) 500
14.7 高级编程(Advanced Programming) 501
14.7.1 动多态设计模式(Dynamic Polymorphism Design Patterns) 501
14.7.2 静多态设计模式(Static Polymorphism Design Patterns) 503
14.7.3 泛型编程(Generic Programming) 504
14.8 目的归纳(Conclusion) 506
练习14(Exercises 14) 507