4 | Arrays | 252 |
4.1 | Introduction | 253 |
4.2 | Arrays | 253 |
4.3 | Declaring Arrays | 255 |
4.4 | Examples Using Arrays | 256 |
4.5 | Passing Arrays to Functions | 272 |
4.6 | Sorting Arrays | 276 |
4.7 | Case Study: Computing Mean, Median and Mode Using Arrays | 278 |
4.8 | Searching Arrays: Linear Search and Binary Search | 283 |
4.9 | Multiple-Subscripted Arrays | 289 |
4.10 | [Optional Case Study] Thinking About Objects: Identifying the Operations of a Class | 296 |
5 | Pointers and Strings | 319 |
5.1 | Introduction | 320 |
5.2 | Pointer Variable Declarations and Initialization | 320 |
5.3 | Pointer Operators | 322 |
5.4 | Calling Functions by Reference | 325 |
5.5 | Using const with Pointers | 329 |
5.6 | Bubble Sort Using Pass-by-Reference | 336 |
5.7 | Pointer Expressions and Pointer Arithmetic | 341 |
5.8 | Relationship Between Pointers and Arrays | 344 |
5.9 | Arrays of Pointers | 349 |
5.10 | Case Study: Card Shuffling and Dealing Simulation | 350 |
5.11 | Function Pointers | 355 |
5.12 | Introduction to Character and String Processing | 360 |
5.12.1 | Fundamentals of Characters and Strings | 360 |
5.12.2 | String Manipulation Functions of the String-Handling Library | 362 |
5.13 | [Optional Case Study] Thinking About Objects: Collaborations Among Objects | 370 |
6 | Classes and Data Abstraction | 404 |
6.1 | Introduction | 405 |
6.2 | Structure Definitions | 406 |
6.3 | Accessing Structure Members | 407 |
6.4 | Implementing User-Defined Type Time with a C-like struct | 408 |
6.5 | Implementing Abstract Data Type Time with a class | 411 |
6.6 | Class Scope and Accessing Class Members | 418 |
6.7 | Separating Interface from Implementation | 420 |
6.8 | Controlling Access to Members | 424 |
6.9 | Access Functions and Utility Functions | 426 |
6.10 | Initializing Class Objects: Constructors | 430 |
6.11 | Using Default Arguments with Constructors | 430 |
6.12 | Destructors | 435 |
6.13 | When Constructors and Destructors Are Called | 435 |
6.14 | Using Set and Get Functions | 439 |
6.15 | Subtle Trap: Returning a Reference to a private Data Member | 445 |
6.16 | Default Memberwise Assignment | 448 |
6.17 | Software Reusability | 450 |
6.18 | [Optional Case Study) Thinking About Objects: Starting to Program the Classes for the Elevator Simulator | 451 |
7 | Classes: Part II | 468 |
7.1 | Introduction | 469 |
7.2 | const (Constant) Objects and const Member Functions | 469 |
7.3 | Composition: Objects as Members of Classes | 478 |
7.4 | friend Functions and friend Classes | 485 |
7.5 | Using the this Pointer | 489 |
7.6 | Dynamic Memory Management with Operators new and delete | 495 |
7.7 | static Class Members | 497 |
7.8 | Data Abstraction and Information Hiding | 502 |
7.8.1 | Example: Array Abstract Data Type | 504 |
7.8.2 | Example: String Abstract Data Type | 504 |
7.8.3 | Example: Queue Abstract Data Type | 505 |
7.9 | Container Classes and Iterators | 505 |
7.10 | Proxy Classes | 506 |
7.11 | [Optional Case Study] Thinking About Objects: Programming the Classes for the Elevator Simulator | 509 |