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
评论13
最新资源