Matthew Telles076457986X, 9780764579868, 9780764595585
Table of contents :
Team DDU……Page 1
Contents……Page 12
Introduction……Page 17
Conventions Used in This Book……Page 18
Part V: Arrays and Templates……Page 19
Icons Used in This Book……Page 20
Part I: Streamlining the Means and Mechanics of OOP……Page 21
Creating and Implementing an Encapsulated Class……Page 22
Making Updates to an Encapsulated Class……Page 25
Creating a Mailing-List Application……Page 27
Testing the Mailing-List Application……Page 32
Technique 3: Customizing a Class with Virtual Functions……Page 34
Customizing a Class with Polymorphism……Page 35
Testing the Virtual Function Code……Page 36
Why Do the Destructors Work?……Page 37
Technique 4: Inheriting Data and Functionality……Page 38
Implementing a ConfigurationFile Class……Page 39
Delayed Construction……Page 42
Technique 5: Separating Rules and Data from Code……Page 45
The cDate Class……Page 46
Testing the cDate Class……Page 50
Part II: Working with the Pre-Processor……Page 52
Creating the Header File……Page 54
Testing the Header File……Page 55
The Assert Problem……Page 57
Fixing the Assert Problem……Page 59
Technique 8: Using const Instead of #define……Page 60
Using the const Construct……Page 61
Fixing the Errors……Page 62
Technique 9: Macros and Why Not to Use Them……Page 63
Initiating a Function with a String Macro – Almost……Page 64
Fixing What Went Wrong with the Macro……Page 65
Using Macros Appropriately……Page 66
Using the sizeof Function……Page 67
Evaluating the Results……Page 69
Using sizeof with Pointers……Page 70
Part III: Types……Page 72
Technique 11: Creating Your Own Basic Types……Page 74
Implementing the Range Class……Page 75
Testing the Range Class……Page 77
Technique 12: Creating Your Own Types……Page 78
Creating the Matrix Class……Page 79
Matrix Operations……Page 80
Multiplying a Matrix by a Scalar Value……Page 81
Multiplying a Matrix by Scalar Values, Take 2……Page 82
Testing the Matrix Class……Page 83
Technique 13: Using Enumerations……Page 85
Implementing the Enumeration Class……Page 86
Testing the Enumeration Class……Page 87
Technique 14: Creating and Using Structures……Page 88
Implementing Structures……Page 89
Interpreting the Output……Page 90
Defining Constants……Page 92
Implementing Constant Variables……Page 93
Testing the Constant Application……Page 95
Using the const Keyword……Page 96
Technique 16: Scoping Your Variables……Page 97
Illustrating Scope……Page 98
Interpreting the Output……Page 99
Technique 17: Using Namespaces……Page 100
Creating a Namespace Application……Page 101
Testing the Namespace Application……Page 103
Technique 18: Fixing Breaks with Casts……Page 105
Using Casts……Page 106
Addressing the Compiler Problems……Page 108
Testing the Changes……Page 109
Technique 19: Using Pointers to Member Functions……Page 111
Implementing Member-Function Pointers……Page 112
Testing the Member Pointer Code……Page 114
Technique 20: Defining Default Arguments for Your Functions and Methods……Page 116
Customizing the Functions We Didn’t Write……Page 117
Customizing Functions We Wrote Ourselves……Page 118
Testing the Default Code……Page 120
Fixing the Problem……Page 121
Part IV: Classes……Page 122
Technique 21: Creating a Complete Class……Page 124
Creating a Complete Class Template……Page 125
Testing the Complete Class……Page 128
Technique 22: Using Virtual Inheritance……Page 131
Implementing Virtual Inheritance……Page 133
Correcting the Code……Page 134
Technique 23: Creating Overloaded Operators……Page 135
Rules for Creating Overloaded Operators……Page 136
Using Overloaded Operators……Page 137
Testing the MyString Class……Page 140
Technique 24: Defining Your Own new and delete Handlers……Page 143
Overloading new and delete Handlers……Page 144
Testing the Memory Allocation Tracker……Page 148
Technique 25: Implementing Properties……Page 151
Implementing Properties……Page 152
Testing the Property Class……Page 155
Implementing Data Validation with Classes……Page 157
Testing Your SSN Validator Class……Page 161
Technique 27: Building a Date Class……Page 164
Creating the Date Class……Page 165
Implementing the Date Functionality……Page 167
Testing the Date Class……Page 174
Some Final Thoughts on the Date Class……Page 176
Technique 28: Overriding Functionality with Virtual Methods……Page 177
Creating a Factory Class……Page 178
Testing the Factory……Page 181
Enhancing the Manager Class……Page 182
Technique 29: Using Mix-In Classes……Page 183
Implementing Mix-In Classes……Page 184
Compiling and Testing Your Mix-In Class……Page 185
Part V: Arrays and Templates……Page 188
Technique 30: Creating a Simple Template Class……Page 190
Technique 31: Extending a Template Class……Page 194
Implementing Template Classes in Code……Page 195
Testing the Template Classes……Page 197
Using Non-class Template Arguments……Page 199
Implementing Function Templates……Page 201
Creating Method Templates……Page 204
Using the Vector Class……Page 207
Creating the String Array Class……Page 211
Working with Vector Algorithms……Page 215
Examining Allocations of Arrays and Pointers……Page 219
Technique 37: Creating Arrays of Objects……Page 224
Creating an Array of Heterogeneous Objects……Page 228
Technique 39: Implementing a Spreadsheet……Page 231
Creating the Column Class……Page 232
Creating the Row Class……Page 233
Creating the Spreadsheet Class……Page 234
Testing Your Spreadsheet……Page 236
Part VI: Input and Output……Page 238
Working with Streams……Page 240
Technique 41: Reading In and Processing Files……Page 243
Testing the File-Reading Code……Page 247
Creating the Test File……Page 248
Reading Delimited Files……Page 249
Testing the Code……Page 253
Technique 43: Writing Your Objects as XML……Page 255
Creating the XML Writer……Page 256
Testing the XML Writer……Page 258
Technique 44: Removing White Space from Input……Page 261
Technique 45: Creating a Configuration File……Page 265
Creating the Configuration-File Class……Page 266
Testing the Configuration-File Class……Page 275
Part VII: Using the Built-In Functionality……Page 278
Technique 46: Creating an Internationalization Class……Page 280
Building the Language Files……Page 281
Reading the International File……Page 287
Testing the String Reader……Page 292
Creating a Translator Class……Page 294
Testing the Translator Class……Page 296
Creating a Virtual File Class……Page 298
Testing the Virtual File Class……Page 304
Improving Your Virtual File Class……Page 305
Technique 49: Using Iterators for Your Collections……Page 306
Technique 50: Overriding the Allocator for a Collection Class……Page 312
Creating a Custom Memory Allocator……Page 313
Using the auto_ptr Class……Page 318
Creating a Memory Safe Buffer Class……Page 322
Throwing and Logging Exceptions……Page 327
Dealing with Unhandled Exceptions……Page 332
Re-throwing Exceptions……Page 334
Technique 54: Enforcing Return Codes……Page 338
Technique 55: Using Wildcards……Page 345
Creating the Wildcard Matching Class……Page 346
Testing the Wildcard Matching Class……Page 348
Part VIII: Utilities……Page 350
Technique 56: Encoding and Decoding Data for the Web……Page 352
Creating the URL Codec Class……Page 353
Testing the URL Codec Class……Page 355
Technique 57: Encrypting and Decrypting Strings……Page 358
Implementing the Rot13 Algorithm……Page 359
Testing the Rot13 Algorithm……Page 360
Implementing the XOR Algorithm……Page 361
Testing the XOR Algorithm……Page 362
Technique 58: Converting the Case of a String……Page 364
Implementing the transform Function to Convert Strings……Page 365
Testing the String Conversions……Page 366
Technique 59: Implementing a Serialization Interface……Page 369
Implementing the Serialization Interface……Page 370
Testing the Serialization Interface……Page 373
Technique 60: Creating a Generic Buffer Class……Page 375
Creating the Buffer Class……Page 376
Testing the Buffer Class……Page 379
Technique 61: Opening a File Using Multiple Paths……Page 381
Creating the Multiple-Search-Path Class……Page 382
Testing the Multiple-Search-Path Class……Page 384
Part IX: Debugging C++ Applications……Page 388
Technique 62: Building Tracing into Your Applications……Page 390
Implementing the Flow Trace Class……Page 391
Testing the Flow Trace System……Page 394
Adding in Tracing After the Fact……Page 395
The assert Macro……Page 402
Logging……Page 404
Testing the Logger Class……Page 405
Design by Contract……Page 407
Technique 64: Debugging Overloaded Methods……Page 414
Adding Logging to the Application……Page 416
Part X: The Scary (or Fun!) Stuff……Page 420
Making Functions Inline……Page 422
Avoiding Temporary Objects……Page 423
Passing Objects by Reference……Page 425
Postponing Variable Declarations……Page 427
Choosing Initialization Instead of Assignment……Page 428
Learning How Code Operates……Page 431
Testing the Properties Class……Page 433
Technique 67: Creating a Simple Locking Mechanism……Page 435
Creating the Locking Mechanism……Page 436
Testing the Locking Mechanism……Page 437
Technique 68: Creating and Using Guardian Classes……Page 440
Creating the File-Guardian Class……Page 441
Testing the File-Guardian Class……Page 445
Technique 69: Working with Complex Numbers……Page 447
Implementing the Complex Class……Page 448
Testing the Complex Number Class……Page 451
Technique 70: Converting Numbers to Words……Page 454
Creating the Conversion Code……Page 455
Testing the Conversion Code……Page 461
A Sample Program……Page 462
Componentizing……Page 464
Restructuring……Page 466
Specialization……Page 467
Index……Page 470
Reviews
There are no reviews yet.