没有合适的资源?快使用搜索试试~ 我知道了~
c语言---java
需积分: 10 2 下载量 126 浏览量
2018-09-01
12:14:00
上传
评论
收藏 9.92MB PDF 举报
温馨提示
试读
290页
c语言语言给java程序师的
资源推荐
资源详情
资源评论
v
Contents
Preface xv
Chapter 0 Introduction 1
0.1 A History Lesson 1
0.2 High Level Differences 4
0.2.1 Compiled vs. Interpreted Code 4
0.2.2 Security and Robustness 4
0.2.3 Multithreading 5
0.2.4 API Differences 5
0.3 Ten Reasons To Use C++ 6
0.3.1 C++ Is Still Widely Used 6
0.3.2 Templates 6
0.3.3 Operator Overloading 6
0.3.4 Standard Template Library 6
0.3.5 Automatic Reclamation of Resources 6
0.3.6 Conditional Compilation 8
0.3.7 Distinctions Between Accessor and Mutator 8
0.3.8 Multiple Implementation Inheritance 8
0.3.9 Space Efficiency 8
0.3.10 Private Inheritance 8
0.4 Key Points 8
0.5 Exercises 9
c++book.mif Page v Saturday, July 12, 2003 10:53 AM
vi Contents
Chapter 1 Basic Types and Control Structures 11
1.1 First Program 11
1.1.1 main Function 11
1.1.2 The Preprocessor 12
1.1.3 The using directive 13
1.1.4 Output 13
1.2 Primitive Types 13
1.2.1 Integer Types 13
1.2.2 Floating Point Types 14
1.2.3 Character Type 14
1.2.4 Boolean Type 14
1.3 Syntactic Differences 15
1.3.1 Operators and Expressions 15
1.3.2 Conditionals 15
1.3.3 Loops 16
1.3.4 Definite Assignment 16
1.4 Additional Syntax 16
1.4.1 Primitive Type Casts 16
1.4.2 Labels 17
1.4.3 typedef Statement 17
1.5 Key Points 18
1.6 Exercises 19
Chapter 2 Functions, Arrays, Strings, and Parameter Passing 21
2.1 Functions 21
2.1.1 Function definition 21
2.1.2 Function Invocation 21
2.1.3 Function Overloading 22
2.1.4 Function Declarations 22
2.1.5 Default Parameters 24
2.1.6 Inline Functions 24
2.1.7 Separate Compilation 25
2.2 Arrays and Strings 26
2.2.1 Using the vector Library Type 27
2.2.2 Using the string Library Type 28
2.2.3 Arrays of Objects 29
2.2.4 Primitive Arrays of Constants 30
c++book.mif Page vi Saturday, July 12, 2003 10:53 AM
Contents vii
2.2.5 Multidimensional Arrays 30
2.3 Parameter Passing 31
2.3.1 Call by Reference 31
2.3.2 Call by Constant Reference 33
2.3.3 Parameter Passing Summary 34
2.4 Key Points 35
2.5 Exercises 35
Chapter 3 Pointers and Reference Variables 37
3.1 Java vs. C++ Memory Model 37
3.2 Pointers 38
3.3 Memory Heap Management 43
3.3.1 The new Operator 43
3.3.2 Garbage collection and delete operator 43
3.3.3 Stale pointers 45
3.3.4 Double-delete 45
3.3.5 Functions that Return Pointers 46
3.4 The -> Operator 48
3.5 Reference Variables 48
3.6 Uses and Abuses of Pointer Variables 49
3.6.1 Parameter Passing: Simulating Call-By-Reference 49
3.6.2 Arrays and Strings 49
3.6.3 Avoiding Large Data Movements 50
3.6.4 Linked Data Structures 50
3.6.5 Inheritance 50
3.7 Key Points 50
3.8 Exercises 51
Chapter 4 Object-Based Programming: Classes 53
4.1 Similarities, Modulo Syntax 54
4.2 Accessors vs. Mutators 55
4.3 The explicit Keyword 56
4.4 Why C++ Needs More Syntax Than Java 58
4.5 Initializer Lists 61
4.6 The Big Three: Destructor, Copy Constructor, and operator= 64
4.6.1 Destructor 64
4.6.2 Copy Constructor 64
4.6.3 operator= 64
c++book.mif Page vii Saturday, July 12, 2003 10:53 AM
viii Contents
4.6.4 Issues Concerning the Defaults 65
4.6.5 When the Defaults Do Not Work 66
4.6.6 Linked Data Structures 69
4.6.7 Default Constructor 74
4.6.8 Disabling Copying 74
4.7 Friends 74
4.7.1 Classes as friends 75
4.7.2 Methods as friends 75
4.8 Nested Classes 76
4.9 The struct Type 77
4.10 Return By Constant Reference Revisited 77
4.11 Separation of Interface and Implementation 79
4.12 #ifndef and #endif 81
4.13 Static Members 82
4.14 Anonymous Objects 85
4.15 Namespaces 86
4.16 Incomplete Class Declaration 87
4.17 Technical Differences 88
4.17.1 Member Functions and Data Members Cannot Have Same Name
88
4.17.2 Inline Data Member Initialization 88
4.17.3 Default Data Member Initialization 88
4.17.4 Default Visibility 88
4.18 Key Points 88
4.19 Exercises 89
Chapter 5 Operator Overloading 91
5.1 Basics of Operator Overloading 91
5.2 Overloading I/O 93
5.3 Global vs. Class Operators 94
5.4 What Can Be Overloaded? 97
5.5 A Rational Number Class 97
5.5.1 Assignment Operators 103
5.5.2 Arithmetic Operators 103
5.5.3 Relational and Equality Operators 105
5.5.4 Input and Output Operators 105
5.5.5 Unary Operators 106
5.6 Matrix Class (for doubles) 107
c++book.mif Page viii Saturday, July 12, 2003 10:53 AM
剩余289页未读,继续阅读
资源评论
兔老弟
- 粉丝: 0
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功