You are previewing Visual C++ 2008: How to Program, Second Edition.
O'Reilly logo
Visual C++ 2008: How to Program, Second Edition

Book Description

Based on the authors’ highly popular C++-standard-compliant textbook, C++ How to Program, 6/e, Visual C++ How to Program 2/ E builds off this successful approach to offer readers a comprehensive introduction to Visual C++.  Through their ongoing consultation with the Microsoft Visual C++ team, the Deitels have developed an approach that focuses on native C++ and presents examples of .NET managed code programming with C++/CLI, where appropriate. The book takes an easy-to-follow, carefully developed early classes and objects approach.  This includes comprehensive coverage of the Visual C++ environment. 

Like other books in the How to Program series, the new edition retains the Deitels' classic approach to developing good programming skills.  These tools have been refined over a combined six decades of academic and industry teaching experience.  This approach has been the foundation of several programmers in industry today.

Table of Contents

  1. Copyright
    1. Dedication
  2. Deitel ® Series Page
    1. How To Program Series
      1. Simply Series
    2. SafariX Web Books
  3. Deitel Resource Centers
  4. Preface
    1. New and Updated Features
    2. Dependency Chart
    3. Teaching Approach
    4. Object-Oriented Design of an ATM with the UML: A Tour of the Optional Software Engineering Case Study
      1. Instructor Resources for Visual C++ 2008 How to Program, 2/e
      2. Ordering Option for the Education Market
      3. Deitel® Buzz Online Free E-mail Newsletter
      4. The Deitel Online Resource Centers
      5. Acknowledgments
      6. About the Authors
      7. About Deitel & Associates, Inc.
  5. Before You Begin
    1. Download Microsoft Visual C++® 2008 Express
    2. Download the Visual C++ 2008 How to Program, 2/e Source Code
  6. 1. Introduction to Computers, the Internet and Visual C++
    1. 1.1. Introduction
    2. 1.2. What Is a Computer?
    3. 1.3. Computer Organization
    4. 1.4. Early Operating Systems
    5. 1.5. Personal Computing, Distributed Computing and Client/Server Computing
    6. 1.6. The Internet and the World Wide Web
    7. 1.7. Hardware Trends
    8. 1.8. Microsoft’s Windows® Operating System
    9. 1.9. Machine Languages, Assembly Languages and High-Level Languages
      1. Machine Languages
      2. Assembly Languages
      3. High-Level Languages
    10. 1.10. Visual C++
    11. 1.11. C++ Standard Library
    12. 1.12. Java, C# and Visual Basic
      1. Java
      2. Visual C#
      3. Visual Basic
    13. 1.13. Other High-Level Languages
      1. Fortran
      2. COBOL
      3. Pascal
      4. Ada
    14. 1.14. Microsoft’s .NET
    15. 1.15. The .NET Framework and the Common Language Runtime
    16. 1.16. Key Software Trend: Object Technology
    17. 1.17. Typical Visual C++ Development Life Cycle
      1. Phase 1: Creating a Program
      2. Phases 2 and 3: Preprocessing and Compiling a C++ Program
      3. Phase 4: Linking
      4. Phase 5: Loading
      5. Phase 6: Execution
      6. Problems That May Occur at Execution Time
    18. 1.18. Test-Driving a Visual C++ Application
      1. Running a Visual C++ Application from the Command Prompt
    19. 1.19. Software Technologies
    20. 1.20. Future of Visual C++: Open Source Boost Libraries, TR1 and C++0x
    21. 1.21. (Only Required Section of the Case Study) Software Engineering Case Study: Introduction to Object Technology and the UML
      1. Basic Object Technology Concepts
      2. Classes, Data Members and Functions
      3. Introduction to Object-Oriented Analysis and Design (OOAD)
      4. History of the UML
      5. What is the UML?
      6. Internet and Web UML Resources
      7. Recommended Readings
      8. Section 1.21 Self-Review Exercises
      9. Answers to Section 1.21 Self-Review Exercises
    22. 1.22. Wrap-Up
    23. Summary
      1. Section 1.1 Introduction
      2. Section 1.2 What Is a Computer?
      3. Section 1.3 Computer Organization
      4. Section 1.4 Early Operating Systems
      5. Section 1.5 Personal Computing, Distributed Computing and Client/Server Computing
      6. Section 1.6 The Internet and the World Wide Web
      7. Section 1.7 Hardware Trends
      8. Section 1.8 Microsoft’s Windows® Operating System
      9. Section 1.9 Machine Languages, Assembly Languages and High-Level Languages
      10. Section 1.10 Visual C++
      11. Section 1.12 Java, C# and Visual Basic
      12. Section 1.13 Other High-Level Languages
      13. Section 1.14 Microsoft’s .NET
      14. Section 1.15 The .NET Framework and the Common Language Runtime
      15. Section 1.16 Key Software Trend: Object Technology
      16. Section 1.17 Typical Visual C++ Development Life Cycle
      17. Section 1.20 Future of Visual C++: Open Source Boost Libraries, TR1 and C++0x
      18. Section 1.21 (Only Required Section of the Case Study) Software Engineering Case Study: Introduction to Object Technology and the UML
    24. Terminology
    25. Self-Review Exercises
    26. Answers to Self-Review Exercises
    27. Exercises
  7. 2. Dive Into® Visual C++® 2008 Express
    1. 2.1. Introduction
    2. 2.2. Overview of the Visual Studio 2008 IDE
      1. Introduction to Microsoft Visual C++ 2008 Express Edition
      2. Links on the Start Page
      3. Creating a New Project
      4. Creating a New C++ Project
      5. Creating a New C++/CLI Project
    3. 2.3. Menu Bar and Toolbars
    4. 2.4. Navigating the Visual Studio 2008 IDE
      1. 2.4.1. Solution Explorer
      2. 2.4.2. Properties Window
    5. 2.5. Using Help
    6. 2.6. Wrap-Up
    7. Summary
      1. Section 2.1 Introduction
      2. Section 2.2 Overview of the Visual Studio 2008 IDE
      3. Section 2.3 Menu Bar and Toolbars
      4. Section 2.4 Navigating the Visual Studio 2008 IDE
      5. Section 2.5 Using Help
    8. Terminology
    9. Self-Review Exercises
    10. Answers to Self-Review Exercises
    11. Exercises
  8. 3. Introduction to Visual C++ Programming
    1. 3.1. Introduction
    2. 3.2. First Program in Visual C++: Printing a Line of Text
    3. 3.3. Modifying Our First Visual C++ Program
      1. Printing a Single Line of Text with Multiple Statements
      2. Printing Multiple Lines of Text with a Single Statement
    4. 3.4. Another Visual C++ Program: Adding Integers
    5. 3.5. Memory Concepts
    6. 3.6. Arithmetic
      1. Arithmetic Expressions in Straight-Line Form
      2. Parentheses for Grouping Subexpressions
      3. Rules of Operator Precedence
      4. Sample Algebraic and Visual C++ Expressions
      5. Evaluation of a Second-Degree Polynomial
    7. 3.7. Decision Making: Equality and Relational Operators
    8. 3.8. (Optional) Software Engineering Case Study: Examining the ATM Requirements Specification
      1. Requirements Specification
      2. Analyzing the ATM System
      3. Use Case Diagrams
      4. Designing the ATM System
      5. Internet and Web Resources
      6. Recommended Readings
      7. Software Engineering Case Study Self-Review Exercises
      8. Answers to Software Engineering Case Study Self-Review Exercises
    9. 3.9. Wrap-Up
    10. Summary
      1. Section 3.2 First Program in Visual C++: Printing a Line of Text
      2. Section 3.3 Modifying Our First Visual C++ Program
      3. Section 3.4 Another Visual C++ Program: Adding Integers
      4. Section 3.5 Memory Concepts
      5. Section 3.6 Arithmetic
      6. Section 3.7 Decision Making: Equality and Relational Operators
    11. Terminology
    12. Self-Review Exercises
    13. Answers to Self-Review Exercises
    14. Exercises
  9. 4. Introduction to Classes and Objects
    1. 4.1. Introduction
    2. 4.2. Classes, Objects, Member Functions and Data Members
    3. 4.3. Overview of the Chapter Examples
    4. 4.4. Defining a Class with a Member Function
      1. Class GradeBook
      2. Testing Class GradeBook
      3. UML Class Diagram for Class GradeBook
    5. 4.5. Defining a Member Function with a Parameter
      1. Defining and Testing Class GradeBook
      2. More on Arguments and Parameters
      3. Updated UML Class Diagram for Class GradeBook
    6. 4.6. Data Members, set Functions and get Functions
      1. GradeBook Class with a Data Member, a set Function and a get Function
      2. Access Specifiers public and private
      3. Member Functions setCourseName and getCourseName
      4. Member Function displayMessage
      5. Testing Class GradeBook
      6. Software Engineering with set and get Functions
      7. GradeBook’s UML Class Diagram with a Data Member and set and get Functions
    7. 4.7. Initializing Objects with Constructors
      1. Defining a Constructor
      2. Testing Class GradeBook
      3. Two Ways to Provide a Default Constructor for a Class
      4. Adding the Constructor to Class GradeBook’s UML Class Diagram
    8. 4.8. Placing a Class in a Separate File for Reusability
      1. Header Files
      2. Including a Header File That Contains a User-Defined Class
      3. How Header Files Are Located
      4. Additional Software Engineering Issues
    9. 4.9. Separating Interface from Implementation
      1. Interface of a Class
      2. Separating the Interface from the Implementation
      3. GradeBook.h: Defining a Class’s Interface with Function Prototypes
      4. GradeBook.cpp: Defining Member Functions in a Separate Source-Code File
      5. Testing Class GradeBook
      6. The Compilation and Linking Process
    10. 4.10. Validating Data with set Functions
      1. GradeBook Class Definition
      2. Validating the Course Name with GradeBook Member Function setCourseName
      3. Testing Class GradeBook
      4. Additional Notes on Set Functions
    11. 4.11. Defining a Managed Class with Member Functions in C++/CLI
    12. 4.12. Instance Variables and Properties in C++/CLI
    13. 4.13. (Optional) Software Engineering Case Study: Identifying the Classes in the ATM Requirements Specification
      1. Identifying the Classes in a System
      2. Modeling Classes
      3. Software Engineering Case Study Self-Review Exercises
      4. Answers to Software Engineering Case Study Self-Review Exercises
    14. 4.14. Wrap-Up
    15. Summary
      1. Section 4.2 Classes, Objects, Member Functions and Data Members
      2. Section 4.4 Defining a Class with a Member Function
      3. Section 4.5 Defining a Member Function with a Parameter
      4. Section 4.6 Data Members, set Functions and get Functions
      5. Section 4.7 Initializing Objects with Constructors
      6. Section 4.8 Placing a Class in a Separate File for Reusability
      7. Section 4.9 Separating Interface from Implementation
      8. Section 4.10 Validating Data with set Functions
      9. Section 4.11 Defining a Managed Class with Member Functions in C++/CLI
      10. Section 4.12 Instance Variables and Properties in C++/CLI
    16. Terminology
    17. Self-Review Exercises
    18. Answers to Self-Review Exercises
    19. Exercises
  10. 5. Control Statements: Part 1
    1. 5.1. Introduction
    2. 5.2. Algorithms
    3. 5.3. Pseudocode
    4. 5.4. Control Structures
      1. Sequence Structure in Visual C++
      2. Selection Statements in Visual C++
      3. Repetition Statements in Visual C++
      4. Summary of Control Statements in Visual C++
    5. 5.5. if Selection Statement
    6. 5.6. if ...else Double-Selection Statement
      1. Conditional Operator (?:)
      2. Nested if ...else Statements
      3. Dangling-else Problem
      4. Blocks
    7. 5.7. while Repetition Statement
    8. 5.8. Formulating Algorithms: Counter-Controlled Repetition
      1. Pseudocode Algorithm with Counter-Controlled Repetition
      2. Enhancing GradeBook Validation
      3. Implementing Counter-Controlled Repetition in Class GradeBook
      4. Demonstrating Class GradeBook
      5. Notes on Integer Division and Truncation
    9. 5.9. Formulating Algorithms: Sentinel-Controlled Repetition
      1. Developing the Pseudocode Algorithm with Top-Down, Stepwise Refinement: The Top and First Refinement
      2. Proceeding to the Second Refinement
      3. Implementing Sentinel-Controlled Repetition in Class GradeBook
      4. Program Logic for Sentinel-Controlled Repetition vs. Counter-Controlled Repetition
      5. Floating-Point Number Precision and Memory Requirements
      6. Converting Between Fundamental Types Explicitly and Implicitly
      7. Formatting for Floating-Point Numbers
    10. 5.10. Formulating Algorithms: Nested Control Statements
      1. Conversion to Class Analysis
      2. Demonstrating Class Analysis
    11. 5.11. Assignment Operators
    12. 5.12. Increment and Decrement Operators
    13. 5.13. (Optional) Software Engineering Case Study: Identifying Class Attributes in the ATM System
      1. Identifying Attributes
      2. Modeling Attributes
      3. Software Engineering Case Study Self-Review Exercises
      4. Answers to Software Engineering Case Study Self-Review Exercises
    14. 5.14. Wrap-Up
    15. Summary
      1. Section 5.2 Algorithms
      2. Section 5.3 Pseudocode
      3. Section 5.4 Control Structures
      4. Section 5.5 if Selection Statement
      5. Section 5.6 if ...else Double-Selection Statement
      6. Section 5.7 while Repetition Statement
      7. Section 5.8 Formulating Algorithms: Counter-Controlled Repetition
      8. Section 5.9 Formulating Algorithms: Sentinel-Controlled Repetition
      9. Section 5.10 Formulating Algorithms: Nested Control Statements
      10. Section 5.11 Assignment Operators
      11. Section 5.12 Increment and Decrement Operators
    16. Terminology
    17. Self-Review Exercises
    18. Answers to Self-Review Exercises
    19. Exercises
  11. 6. Control Statements: Part 2
    1. 6.1. Introduction
    2. 6.2. Essentials of Counter-Controlled Repetition
    3. 6.3. for Repetition Statement
      1. for-Statement Header Components
      2. for-Statement UML Activity Diagram
    4. 6.4. Examples Using the for Statement
      1. Application: Summing the Even Integers from 2 to 20
      2. Application: Compound Interest Calculations
      3. A Caution about Using Type float or double for Monetary Amounts
      4. Using Stream Manipulators to Format Numeric Output
    5. 6.5. do...while Repetition Statement
      1. do...while Statement UML Activity Diagram
    6. 6.6. switch Multiple-Selection Statement
      1. GradeBook Class with switch Statement to Count A, B, C, D and F Grades
      2. Reading Character Input
      3. switch-Statement Details
      4. Providing a default Case
      5. Ignoring Newline, Tab and Blank Characters in Input
      6. Testing Class GradeBook
      7. switch-Statement UML Activity Diagram
      8. Notes on Data Types
    7. 6.7. break and continue Statements
      1. break Statement
      2. continue Statement
    8. 6.8. Logical Operators
      1. Logical AND (&&) Operator
      2. Logical OR (||) Operator
      3. Logical Negation (!) Operator
      4. Logical Operators Example
      5. Summary of Operator Precedence and Associativity
    9. 6.9. Confusing the Equality (==) and Assignment (=) Operators
    10. 6.10. Structured Programming Summary
    11. 6.11. (Optional) Software Engineering Case Study: Identifying Objects’ States and Activities in the ATM System
      1. State Machine Diagrams
      2. Activity Diagrams
      3. Software Engineering Case Study Self-Review Exercises
      4. Answers to Software Engineering Case Study Self-Review Exercises
    12. 6.12. Wrap-Up
    13. Summary
      1. Section 6.2 Essentials of Counter-Controlled Repetition
      2. Section 6.3 for Repetition Statement
      3. Section 6.4 Examples Using the for Statement
      4. Section 6.5 do...while Repetition Statement
      5. Section 6.6 switch Multiple-Selection Statement
      6. Section 6.7 break and continue Statements
      7. Section 6.8 Logical Operators
      8. Section 6.9 Confusing the Equality (==) and Assignment (=) Operators
      9. Section 6.10 Structured Programming Summary
    14. Terminology
    15. Self-Review Exercises
    16. Answers to Self-Review Exercises
    17. Exercises
  12. 7. Functions and an Introduction to Recursion
    1. 7.1. Introduction
    2. 7.2. Program Components in Visual C++
    3. 7.3. Math Library Functions
    4. 7.4. Function Definitions with Multiple Parameters
    5. 7.5. Function Prototypes and Argument Coercion
      1. Function Signatures
      2. Argument Coercion
      3. Argument Promotion Rules
    6. 7.6. C++ Standard Library Header Files
    7. 7.7. Case Study: Random Number Generation
      1. Rolling a Six-Sided Die
      2. Rolling a Six-Sided Die 6,000,000 Times
      3. Randomizing the Random Number Generator
      4. Generalized Scaling and Shifting of Random Numbers
    8. 7.8. Case Study: Game of Chance; Introducing enum
    9. 7.9. Storage Classes
      1. Storage Class, Scope and Linkage
      2. Storage Class Categories
      3. Local Variables
      4. Register Variables
      5. Static Storage Class
      6. Identifiers with Static Storage Class
    10. 7.10. Scope Rules
    11. 7.11. Function-Call Stack and Activation Records
      1. Function-Call Stack in Action
    12. 7.12. Functions with Empty Parameter Lists
    13. 7.13. Inline Functions
    14. 7.14. References and Reference Parameters
      1. Reference Parameters
      2. Passing Arguments by Value and by Reference
      3. References as Aliases within a Function
      4. Returning a Reference from a Function
    15. 7.15. Default Arguments
    16. 7.16. Unary Scope Resolution Operator
    17. 7.17. Function Overloading
      1. Overloaded square Functions
      2. How the Compiler Differentiates Overloaded Functions
      3. Overloaded Operators
    18. 7.18. Function Templates
    19. 7.19. Recursion
    20. 7.20. Example Using Recursion: Fibonacci Series
    21. 7.21. Recursion vs. Iteration
    22. 7.22. Enumerations in C++/CLI
    23. 7.23. (Optional) Software Engineering Case Study: Identifying Class Operations in the ATM System
      1. Identifying Operations
      2. Modeling Operations
      3. Operations of Class BankDatabase and Class Account
      4. Operations of Class Screen
      5. Operations of Class Keypad
      6. Operations of Class CashDispenser and Class DepositSlot
      7. Operations of Class ATM
      8. Identifying and Modeling Operation Parameters
      9. Software Engineering Case Study Self-Review Exercises
      10. Answers to Software Engineering Case Study Self-Review Exercises
    24. 7.24. Wrap-Up
    25. Summary
      1. Section 7.1 Introduction
      2. Section 7.2 Program Components in Visual C++
      3. Section 7.3 Math Library Functions
      4. Section 7.4 Function Definitions with Multiple Parameters
      5. Section 7.5 Function Prototypes and Argument Coercion
      6. Section 7.6 C++ Standard Library Header Files
      7. Section 7.7 Case Study: Random Number Generation
      8. Section 7.8 Case Study: Game of Chance; Introducing enum
      9. Section 7.9 Storage Classes
      10. Section 7.10 Scope Rules
      11. Section 7.11 Function-Call Stack and Activation Records
      12. Section 7.12 Functions with Empty Parameter Lists
      13. Section 7.13 Inline Functions
      14. Section 7.14 References and Reference Parameters
      15. Section 7.15 Default Arguments
      16. Section 7.16 Unary Scope Resolution Operator
      17. Section 7.17 Function Overloading
      18. Section 7.18 Function Templates
      19. Section 7.19 Recursion
      20. Section 7.20 Example Using Recursion: Fibonacci Series
      21. Section 7.21 Recursion vs. Iteration
      22. Section 7.22 Enumerations in C++/CLI
    26. Terminology
    27. Self-Review Exercises
    28. Answers to Self-Review Exercises
    29. Exercises
  13. 8. Arrays and Vectors
    1. 8.1. Introduction
    2. 8.2. Arrays
    3. 8.3. Declaring Arrays
    4. 8.4. Examples Using Arrays
      1. 8.4.1. Declaring an Array and Using a Loop to Initialize the Array’s Elements
      2. 8.4.2. Initializing an Array in a Declaration with an Initializer List
      3. 8.4.3. Specifying an Array’s Size with a Constant Variable and Setting Array Elements with Calculations
      4. 8.4.4. Summing the Elements of an Array
      5. 8.4.5. Using Bar Charts to Display Array Data Graphically
      6. 8.4.6. Using the Elements of an Array as Counters
      7. 8.4.7. Using Arrays to Summarize Survey Results
      8. 8.4.8. Static Local Arrays and Automatic Local Arrays
    5. 8.5. Passing Arrays to Functions
    6. 8.6. Case Study: Class GradeBook Using an Array to Store Grades
      1. Storing Student Grades in an Array in Class GradeBook
      2. Testing Class GradeBook
    7. 8.7. Searching Arrays with Linear Search
      1. Linear Search
    8. 8.8. Sorting Arrays with Insertion Sort
      1. Insertion Sort
    9. 8.9. Multidimensional Arrays
    10. 8.10. Case Study: Class GradeBook Using a Two-Dimensional Array
      1. Storing Student Grades in a Two-Dimensional Array in Class GradeBook
      2. Testing Class GradeBook
    11. 8.11. Introduction to C++ Standard Library Class Template vector
    12. 8.12. Introduction to Managed Arrays with C++/CLI
      1. Declaring Managed Arrays
      2. Initializer Lists for Managed Arrays
      3. Using Managed Arrays
      4. Passing Managed Arrays to Functions
      5. Array-Bounds Checking
      6. System::Array
    13. 8.13. for each Statement
    14. 8.14. Multidimensional Arrays in C++/CLI
      1. Rectangular Arrays
      2. Jagged Arrays
      3. Two-Dimensional Array Example: Displaying Element Values
      4. Common Multidimensional-Array Manipulations Performed with for Statements
    15. 8.15. (Optional) Software Engineering Case Study: Collaboration Among Objects in the ATM System
      1. Identifying the Collaborations in a System
      2. Interaction Diagrams
      3. Communication Diagrams
      4. Sequence of Messages in a Communication Diagram
      5. Sequence Diagrams
      6. Software Engineering Case Study Self-Review Exercises
      7. Answers to Software Engineering Case Study Self-Review Exercises
    16. 8.16. Wrap-Up
    17. Summary
      1. Section 8.1 Introduction
      2. Section 8.2 Arrays
      3. Section 8.3 Declaring Arrays
      4. Section 8.4 Examples Using Arrays
      5. Section 8.5 Passing Arrays to Functions
      6. Section 8.6 Case Study: Class GradeBook Using an Array to Store Grades
      7. Section 8.7 Searching Arrays with Linear Search
      8. Section 8.8 Sorting Arrays with Insertion Sort
      9. Section 8.9 Multidimensional Arrays
      10. Section 8.11 Introduction to C++ Standard Library Class Template vector
      11. Section 8.12 Introduction to Managed Arrays with C++/CLI
      12. Section 8.13 for each Statement
      13. Section 8.14 Multidimensional Arrays in C++/CLI
    18. Terminology
    19. Self-Review Exercises
    20. Answers to Self-Review Exercises
    21. Exercises
    22. Recursion Exercises
    23. vector Exercises
    24. Managed Array Exercises
  14. 9. Pointers and Pointer-Based Strings
    1. 9.1. Introduction
    2. 9.2. Pointer Variable Declarations and Initialization
    3. 9.3. Pointer Operators
    4. 9.4. Passing Arguments to Functions by Reference with Pointers
    5. 9.5. Using const with Pointers
      1. Nonconstant Pointer to Nonconstant Data
      2. Nonconstant Pointer to Constant Data
      3. Constant Pointer to Nonconstant Data
      4. Constant Pointer to Constant Data
    6. 9.6. Selection Sort Using Pass-by-Reference
    7. 9.7. sizeof Operator
      1. Determining the Sizes of the Fundamental Types, an Array and a Pointer
    8. 9.8. Pointer Expressions and Pointer Arithmetic
    9. 9.9. Relationship Between Pointers and Arrays
    10. 9.10. Arrays of Pointers
    11. 9.11. Case Study: Card Shuffling and Dealing Simulation
    12. 9.12. Function Pointers
      1. Multipurpose Selection Sort Using Function Pointers
      2. Arrays of Pointers to Functions
    13. 9.13. Introduction to Pointer-Based String Processing
      1. 9.13.1. Fundamentals of Characters and Pointer-Based Strings
      2. 9.13.2. String-Manipulation Functions of the String-Handling Library
        1. Copying Strings with strcpy and strncpy
        2. Concatenating Strings with strcat and strncat
        3. Comparing Strings with strcmp and strncmp
        4. Tokenizing a String with strtok
        5. Determining String Lengths
    14. 9.14. Introduction to C++/CLI Handles
      1. Differences Between Handles and Pointers
      2. Handle Operators
      3. Using const with Handles
    15. 9.15. Passing Arguments to Functions by Reference with Handles
    16. 9.16. Tracking References and References to Handles
      1. Passing a Tracking Reference to a Handle to Functions
    17. 9.17. Interior Pointers
    18. 9.18. Wrap-Up
    19. Summary
      1. Section 9.2 Pointer Variable Declarations and Initialization
      2. Section 9.3 Pointer Operators
      3. Section 9.4 Passing Arguments to Functions by Reference with Pointers
      4. Section 9.5 Using const with Pointers
      5. Section 9.6 Selection Sort Using Pass-by-Reference
      6. Section 9.7 sizeof Operator
      7. Section 9.8 Pointer Expressions and Pointer Arithmetic
      8. Section 9.9 Relationship Between Pointers and Arrays
      9. Section 9.10 Arrays of Pointers
      10. Section 9.11 Case Study: Card Shuffling and Dealing Simulation
      11. Section 9.12 Function Pointers
      12. Section 9.13 Introduction to Pointer-Based String Processing
      13. Section 9.14 Introduction to C++/CLI Handles
      14. Section 9.15 Passing Arguments to Functions by Reference with Handles
      15. Section 9.16 Tracking References and References to Handles
      16. Section 9.17 Interior Pointers
    20. Terminology
    21. Self-Review Exercises
    22. Answers to Self-Review Exercises
    23. Exercises
    24. Special Section: Building Your Own Computer
    25. More Pointer Exercises
    26. String-Manipulation Exercises
    27. Special Section: Advanced String-Manipulation Exercises
    28. A Challenging String-Manipulation Project
    29. Handle Exercise
  15. 10. Classes: A DeeperLook, Part 1
    1. 10.1. Introduction
    2. 10.2. Time Class Case Study
      1. Time Class Definition
      2. Time Class Member Functions
      3. Defining Member Functions Outside the Class Definition; Class Scope
      4. Member Functions vs. Global Functions
      5. Using Class Time
      6. Looking Ahead to Composition and Inheritance
      7. Object Size
      8. Pragma Directives
    3. 10.3. Class Scope and Accessing Class Members
    4. 10.4. Separating Interface from Implementation
    5. 10.5. Access Functions and Utility Functions
    6. 10.6. Time Class Case Study: Constructors with Default Arguments
      1. Notes Regarding Class Time’s Set and Get Functions and Constructor
    7. 10.7. Destructors
    8. 10.8. When Constructors and Destructors Are Called
    9. 10.9. Time Class Case Study: A Subtle Trap—Returning a Reference to a private Data Member
    10. 10.10. Default Memberwise Assignment
    11. 10.11. Class View and Object Browser
      1. Using the Class View Window
      2. Using the Object Browser
    12. 10.12. (Optional) Software Engineering Case Study: Starting to Program the Classes of the ATM System
      1. Visibility
      2. Navigability
      3. Implementing the ATM System from Its UML Design
      4. Software Engineering Case Study Self-Review Exercises
      5. Answers to Software Engineering Case Study Self-Review Exercises
    13. 10.13. Wrap-Up
    14. Summary
      1. Section 10.2 Time Class Case Study
      2. Section 10.3 Class Scope and Accessing Class Members
      3. Section 10.4 Separating Interface from Implementation
      4. Section 10.5 Access Functions and Utility Functions
      5. Section 10.6 Time Class Case Study: Constructors with Default Arguments
      6. Section 10.7 Destructors
      7. Section 10.8 When Constructors and Destructors Are Called
      8. Section 10.9 Time Class Case Study: A Subtle Trap—Returning a Reference to a private Data Member
      9. Section 10.10 Default Memberwise Assignment
      10. Section 10.11 Class View and Object Browser
    15. Terminology
    16. Self-Review Exercises
    17. Answers to Self-Review Exercises
    18. Exercises
  16. 11. Classes: A DeeperLook, Part 2
    1. 11.1. Introduction
    2. 11.2. const (Constant) Objects and const Member Functions
      1. Defining and Using const Member Functions
      2. Initializing a const Data Member with a Member Initializer
      3. Erroneously Attempting to Initialize a const Data Member with an Assignment
    3. 11.3. Composition: Objects as Members of Classes
    4. 11.4. friend Functions and friend Classes
      1. Modifying a Class’s private Data with a Friend Function
      2. Erroneously Attempting to Modify a private Member with a Non-friend Function
    5. 11.5. Using the this Pointer
      1. Implicitly and Explicitly Using the this Pointer to Access an Object’s Data Members
      2. Using the this Pointer to Enable Cascaded Function Calls
    6. 11.6. Dynamic Memory Management with Operators new and delete
    7. 11.7. static Class Members
      1. Static Constructors
    8. 11.8. Data Abstraction and Information Hiding
      1. 11.8.1. Example: Array Abstract Data Type
      2. 11.8.2. Example: String Abstract Data Type
      3. 11.8.3. Example: Queue Abstract Data Type
    9. 11.9. Container Classes and Iterators
    10. 11.10. Proxy Classes
    11. 11.11. const and friend in C++/CLI
      1. const in C++/CLI
      2. friend in C++/CLI
    12. 11.12. Dynamic Memory Management in C++/CLI
    13. 11.13. Stack Semantics in C++/CLI
    14. 11.14. Finalizers
    15. 11.15. Value Types vs. Reference Types in C++/CLI
      1. C++/CLI Types
      2. Using Managed Value Types
    16. 11.16. Boxing and Unboxing in C++/CLI
    17. 11.17. Indexers
    18. 11.18. Wrap-Up
    19. Summary
      1. Section 11.2 const (Constant) Objects and const Member Functions
      2. Section 11.3 Composition: Objects as Members of Classes
      3. Section 11.4 friend Functions and friend Classes
      4. Section 11.5 Using the this Pointer
      5. Section 11.6 Dynamic Memory Management with Operators new and delete
      6. Section 11.7 static Class Members
      7. Section 11.8 Data Abstraction and Information Hiding
      8. Section 11.9 Container Classes and Iterators
      9. Section 11.10 Proxy Classes
      10. Section 11.11, const and friend in C++/CLI
      11. Section 11.12 Dynamic Memory Management in C++/CLI
      12. Section 11.13 Stack Semantics in C++/CLI
      13. Section 11.14 Finalizers
      14. Section 11.15 Value Types vs. Reference Types in C++/CLI
      15. Section 11.16 Boxing and Unboxing in C++/CLI
      16. Section 11.17 Indexers
    20. Terminology
    21. Self-Review Exercises
    22. Answers to Self-Review Exercises
    23. Exercises
  17. 12. Operator Overloading; String and Array Objects
    1. 12.1. Introduction
    2. 12.2. Fundamentals of Operator Overloading
    3. 12.3. Restrictions on Operator Overloading
      1. Precedence, Associativity and Number of Operands
      2. Creating New Operators
      3. Operators for Fundamental Types
      4. Related Operators
    4. 12.4. Operator Functions as Class Members vs. Global Functions
      1. Operators That Must Be Overloaded as Member Functions
      2. Operators as Member Functions and Global Functions
      3. Why Overloaded Stream Insertion and Stream Extraction Operators Are Overloaded as Global Functions
      4. Commutative Operators
    5. 12.5. Overloading Stream Insertion and Stream Extraction Operators
    6. 12.6. Overloading Unary Operators
    7. 12.7. Overloading Binary Operators
    8. 12.8. Case Study: Array Class
      1. Creating Arrays, Outputting Their Size and Displaying Their Contents
      2. Using the Overloaded Stream Insertion Operator to Fill an Array
      3. Using the Overloaded Inequality Operator
      4. Initializing a New Array with a Copy of an Existing Array’s Contents
      5. Using the Overloaded Assignment Operator
      6. Using the Overloaded Equality Operator
      7. Using the Overloaded Subscript Operator
      8. Array Class Definition
      9. Overloading the Stream Insertion and Stream Extraction Operators as friends
      10. Array Default Constructor
      11. Array Copy Constructor
      12. Array Destructor
      13. getSize Member Function
      14. Overloaded Assignment Operator
      15. Overloaded Equality and Inequality Operators
      16. Overloaded Subscript Operators
    9. 12.9. Converting between Types
    10. 12.10. Case Study: String Class
      1. String Class Definition
      2. Overloading the Stream Insertion and Stream Extraction Operators as friends
      3. String Conversion Constructor
      4. String Copy Constructor
      5. String Destructor
      6. Overloaded Assignment Operator
      7. Overloaded Addition Assignment Operator
      8. Overloaded Negation Operator
      9. Overloaded Equality and Relational Operators
      10. Overloaded Subscript Operators
      11. Overloaded Function-Call Operator
      12. String Member Function getLength
      13. Notes on Our String Class
    11. 12.11. Overloading ++ and --
      1. Overloading the Prefix Increment Operator
      2. Overloading the Postfix Increment Operator
    12. 12.12. Case Study: A Date Class
    13. 12.13. Standard Library Class string
      1. Standard Library Class string
    14. 12.14. explicit Constructors
      1. Accidentally Using a Single-Argument Constructor as a Conversion Constructor
      2. Preventing Accidental Use of a Single-Argument Constructor as a Conversion Constructor
    15. 12.15. C++/CLI Operators and Constructors
      1. Overloaded Arithmetic Assignment Operators
    16. 12.16. Wrap-Up
    17. Summary
      1. Section 12.1 Introduction
      2. Section 12.2 Fundamentals of Operator Overloading
      3. Section 12.3 Restrictions on Operator Overloading
      4. Section 12.4 Operator Functions as Class Members vs. Global Functions
      5. Section 12.5 Overloading Stream Insertion and Stream Extraction Operators
      6. Section 12.6 Overloading Unary Operators
      7. Section 12.7 Overloading Binary Operators
      8. Section 12.8 Case Study: Array Class
      9. Section 12.9 Converting between Types
      10. Section 12.10 Case Study: String Class
      11. Section 12.11 Overloading ++ and --
      12. Section 12.13 Standard Library Class string
      13. Section 12.14 explicit Constructors
      14. Section 12.15 C++/CLI Operators and Constructors
    18. Terminology
    19. Self-Review Exercises
    20. Answers to Self-Review Exercises
    21. Exercises
  18. 13. Object-Oriented Programming: Inheritance
    1. 13.1. Introduction
    2. 13.2. Base Classes and Derived Classes
    3. 13.3. protected Members
    4. 13.4. Relationship between Base Classes and Derived Classes
      1. 13.4.1. Creating and Using a CommissionEmployee Class
      2. 13.4.2. Creating a BasePlusCommissionEmployee Class Without Using Inheritance
        1. Defining Class BasePlusCommissionEmployee
        2. Testing Class BasePlusCommissionEmployee
        3. Exploring the Similarities Between Class BasePlusCommissionEmployee and Class CommissionEmployee
      3. 13.4.3. Creating a CommissionEmployee–BasePlusCommissionEmployee Inheritance Hierarchy
        1. Including the Base-Class Header File in the Derived-Class Header File with #include
        2. Linking Process in an Inheritance Hierarchy
      4. 13.4.4. CommissionEmployee–BasePlusCommissionEmployee Inheritance Hierarchy Using protected Data
        1. Defining Base Class CommissionEmployee with protected Data
        2. Modifying Derived Class BasePlusCommissionEmployee
        3. Testing the Modified BasePlusCommissionEmployee Class
        4. Notes on Using protected Data
      5. 13.4.5. CommissionEmployee–BasePlusCommissionEmployee Inheritance Hierarchy Using private Data
    5. 13.5. Constructors and Destructors in Derived Classes
    6. 13.6. public, protected and private Inheritance
    7. 13.7. Software Engineering with Inheritance
    8. 13.8. Inheritance in C++/CLI
    9. 13.9. Wrap-Up
    10. Summary
      1. Section 13.1 Introduction
      2. Section 13.2 Base Classes and Derived Classes
      3. Section 13.3 protected Members
      4. Section 13.5 Constructors and Destructors in Derived Classes
      5. Section 13.6 public, protected and private Inheritance
      6. Section 13.8 Inheritance in C++/CLI
    11. Terminology
    12. Self-Review Exercises
    13. Answers to Self-Review Exercises
    14. Exercises
  19. 14. Object-Oriented Programming: Polymorphism
    1. 14.1. Introduction
    2. 14.2. Polymorphism Examples
    3. 14.3. Relationships Among Objects in an Inheritance Hierarchy
      1. 14.3.1. Invoking Base-Class Functions from Derived-Class Objects
      2. 14.3.2. Aiming Derived-Class Pointers at Base-Class Objects
      3. 14.3.3. Derived-Class Member-Function Calls via Base-Class Pointers
      4. 14.3.4. Virtual Functions
      5. 14.3.5. Summary of the Allowed Assignments Between Base-Class and Derived-Class Objects and Pointers
    4. 14.4. Type Fields and switch Statements
    5. 14.5. Abstract Classes and Pure virtual Functions
    6. 14.6. Case Study: Payroll System Using Polymorphism
      1. 14.6.1. Creating Abstract Base Class Employee
      2. 14.6.2. Creating Concrete Derived Class SalariedEmployee
      3. 14.6.3. Creating Concrete Derived Class HourlyEmployee
      4. 14.6.4. Creating Concrete Derived Class CommissionEmployee
      5. 14.6.5. Creating Indirect Concrete Derived Class BasePlusCommissionEmployee
      6. 14.6.6. Demonstrating Polymorphic Processing
    7. 14.7. (Optional) Polymorphism, Virtual Functions and Dynamic Binding “Under the Hood”
    8. 14.8. Case Study: Payroll System Using Polymorphism and Runtime Type Information with Downcasting, dynamic_cast, typeid and type_info
    9. 14.9. Virtual Destructors
    10. 14.10. Polymorphism in C++/CLI
      1. Virtual Functions in C++/CLI
      2. Keyword sealed
      3. Keyword Abstract
      4. Keyword Interface Class
      5. Named Overriding
    11. 14.11. (Optional) Software Engineering Case Study: Incorporating Inheritance into the ATM System
      1. Implementing the ATM System Design Incorporating Inheritance
      2. ATM Case Study Wrap-Up
      3. Software Engineering Case Study Self-Review Exercises
      4. Answers to Software Engineering Case Study Self-Review Exercises
    12. 14.12. Wrap-Up
    13. Summary
      1. Section 14.1 Introduction
      2. Section 14.2 Polymorphism Examples
      3. Section 14.3 Relationships Among Objects in an Inheritance Hierarchy
      4. Section 14.4 Type Fields and switch Statements
      5. Section 14.5 Abstract Classes and Pure virtual Functions
      6. Section 14.7 (Optional) Polymorphism, Virtual Functions and Dynamic Binding “Under the Hood”
      7. Section 14.8 Case Study: Payroll System Using Polymorphism and Runtime Type Information with Downcasting, dynamic_cast, typeid and type_info
      8. Section 14.9 Virtual Destructors
      9. Section 14.10 Polymorphism in C++/CLI
    14. Terminology
    15. Self-Review Exercises
    16. Answers to Self-Review Exercises
    17. Exercises
  20. 15. Templates and Generics
    1. 15.1. Introduction
    2. 15.2. Function Templates
      1. Example: Function Template printArray
    3. 15.3. Overloading Function Templates
    4. 15.4. Class Templates
      1. Creating Class Template Stack< T >
      2. Creating a Driver to Test Class Template Stack< T >
      3. Creating Function Templates to Test Class Template Stack< T >
    5. 15.5. Nontype Parameters and Default Types for Class Templates
    6. 15.6. Notes on Templates and Inheritance
    7. 15.7. Notes on Templates and Friends
    8. 15.8. Notes on Templates and static Members
    9. 15.9. Templates in C++/CLI
    10. 15.10. .NET Generics in C++/CLI
      1. Generics Example
    11. 15.11. Generic Type Constraints
      1. IComparable< T > Interface
      2. Specifying Type Constraints
      3. Analyzing the Code
    12. 15.12. Contrasting Templates and Generics
      1. Notes on Generics and Inheritance
      2. Friends and static Members
      3. Why Both Have Generics and Templates
    13. 15.13. Wrap-Up
    14. Summary
      1. Section 15.1 Introduction
      2. Section 15.2 Function Templates
      3. Section 15.3 Overloading Function Templates
      4. Section 15.4 Class Templates
      5. Section 15.5 Nontype Parameters and Default Types for Class Templates
      6. Section 15.6 Notes on Templates and Inheritance
      7. Section 15.7 Notes on Templates and Friends
      8. Section 15.8 Notes on Templates and static Members
      9. Section 15.9 Templates in C++/CLI
      10. Section 15.10 .NET Generics in C++/CLI
      11. Section 15.11 Generic Type Constraints
      12. Section 15.12 Contrasting Templates and Generics
    15. Terminology
    16. Self-Review Exercises
    17. Answers to Self-Review Exercises
    18. Exercises
  21. 16. Exception Handling
    1. 16.1. Introduction
    2. 16.2. Exception-Handling Overview
    3. 16.3. Example: Divide by Zero Without Exception Handling
      1. Running the Application
    4. 16.4. Example: Handling an Attempt to Divide by Zero
      1. Defining an Exception Class to Represent the Type of Problem That Might Occur
      2. Demonstrating Exception Handling
      3. Enclosing Code in a try Block
      4. Defining a catch Handler to Process a DivideByZeroException
      5. Termination Model of Exception Handling
      6. Flow of Program Control When the User Enters a Nonzero Denominator
      7. Flow of Program Control When the User Enters a Denominator of Zero
      8. Uncaught Exceptions
    5. 16.5. When to Use Exception Handling
    6. 16.6. Rethrowing an Exception
    7. 16.7. Processing Unexpected Exceptions
    8. 16.8. Stack Unwinding
    9. 16.9. Constructors, Destructors and Exception Handling
    10. 16.10. Exceptions and Inheritance
    11. 16.11. Processing new Failures
      1. new Throwing bad_alloc on Failure
      2. Handling new Failures Using Function set_new_handler
    12. 16.12. Class auto_ptr and Dynamic Memory Allocation
    13. 16.13. Standard Library Exception Hierarchy
    14. 16.14. Other Error-Handling Techniques
    15. 16.15. .NET Exception Hierarchy with C++/CLI
      1. 16.15.1. Classes ApplicationException and SystemException
      2. 16.15.2. Determining Which Exceptions a Function Throws
    16. 16.16. finally Block in C++/CLI
      1. Moving Resource-Release Code to a finally Block
      2. Demonstrating the finally Block
      3. Throwing Managed Exceptions Using the throw Statement
      4. Rethrowing Managed Exceptions
      5. Returning After a finally Block
      6. Using Stack Semantics and Exception Handling
    17. 16.17. Exception Properties in C++/CLI
      1. Property InnerException
      2. Other Exception Properties
      3. Demonstrating Exception Properties and Stack Unwinding
      4. Throwing an Exception with an InnerException
      5. Displaying Information About the Exception
    18. 16.18. User-Defined Exception Classes in .NET
    19. 16.19. Wrap-Up
    20. Summary
      1. Section 16.1 Introduction
      2. Section 16.2 Exception-Handling Overview
      3. Section 16.3 Example: Divide by Zero Without Exception Handling
      4. Section 16.4 Example: Handling an Attempt to Divide by Zero
      5. Section 16.5 When to Use Exception Handling
      6. Section 16.6 Rethrowing an Exception
      7. Section 16.7 Processing Unexpected Exceptions
      8. Section 16.8 Stack Unwinding
      9. Section 16.9 Constructors, Destructors and Exception Handling
      10. Section 16.10 Exceptions and Inheritance
      11. Section 16.11 Processing new Failures
      12. Section 16.12 Class auto_ptr and Dynamic Memory Allocation
      13. Section 16.13 Standard Library Exception Hierarchy
      14. Section 16.15 .NET Exception Hierarchy with C++/CLI
      15. Section 16.16 finally Block in C++/CLI
      16. Section 16.17 Exception Properties in C++/CLI
      17. Section 16.18 User-Defined Exception Classes in .NET
    21. Terminology
    22. Self-Review Exercises
    23. Answers to Self-Review Exercises
    24. Exercises
  22. 17. Stream Input/Output and Files
    1. 17.1. Introduction
    2. 17.2. Streams
      1. 17.2.1. Classic Streams vs. Standard Streams
      2. 17.2.2. iostream Library Header Files
      3. 17.2.3. Stream-Input/Output Classes and Objects
        1. Stream-I/O Template Hierarchy and Operator Overloading
        2. Standard Stream Objects cin, cout, cerr and clog
        3. File-Processing Templates
    3. 17.3. Stream Output
      1. 17.3.1. Output of char * Variables
      2. 17.3.2. Character Output Using Member Function put
    4. 17.4. Stream Input
      1. 17.4.1. get and getline Member Functions
        1. Using Member Functions eof, get and put
        2. Comparing cin and cin.get
        3. Using Member Function getline
      2. 17.4.2. istream Member Functions peek, putback and ignore
      3. 17.4.3. Type-Safe I/O
    5. 17.5. Unformatted I/O Using read, write and gcount
    6. 17.6. Introduction to Stream Manipulators
      1. 17.6.1. Integral Stream Base: dec, oct, hex and setbase
      2. 17.6.2. Floating-Point Precision (precision, setprecision)
      3. 17.6.3. Field Width (width, setw)
      4. 17.6.4. User-Defined Output Stream Manipulators
    7. 17.7. Stream Format States and Stream Manipulators
      1. 17.7.1. Trailing Zeros and Decimal Points (showpoint)
      2. 17.7.2. Justification (left, right and internal)
      3. 17.7.3. Padding (fill, setfill)
      4. 17.7.4. Integral Stream Base (dec, oct, hex, showbase)
      5. 17.7.5. Floating-Point Numbers; Scientific and Fixed Notation (scientific, fixed)
      6. 17.7.6. Uppercase/Lowercase Control (uppercase)
      7. 17.7.7. Specifying Boolean Format (boolalpha)
      8. 17.7.8. Setting and Resetting the Format State via Member Function flags
    8. 17.8. Stream Error States
    9. 17.9. Tying an Output Stream to an Input Stream
    10. 17.10. Data Hierarchy
    11. 17.11. Files and Streams
    12. 17.12. Creating a Sequential File
    13. 17.13. Reading Data from a Sequential File
    14. 17.14. Updating Sequential Files
    15. 17.15. Wrap-Up
    16. Summary
      1. Section 17.1 Introduction
      2. Section 17.2 Streams
      3. Section 17.3 Stream Output
      4. Section 17.4 Stream Input
      5. Section 17.5 Unformatted I/O Using read, write and gcount
      6. Section 17.6 Introduction to Stream Manipulators
      7. Section 17.7 Stream Format States and Stream Manipulators
      8. Section 17.8 Stream Error States
      9. Section 17.9 Tying an Output Stream to an Input Stream
      10. Section 17.10 Data Hierarchy
      11. Section 17.11 Files and Streams
      12. Section 17.12 Creating a Sequential File
      13. Section 17.13 Reading Data from a Sequential File
      14. Section 17.14 Updating Sequential Files
    17. Terminology
    18. Self-Review Exercises
    19. Answers to Self-Review Exercises
    20. Exercises
  23. 18. Files and Streams in .NET
    1. 18.1. Introduction
    2. 18.2. Files and Streams
    3. 18.3. Classes File and Directory
      1. Demonstrating Classes File and Directory
    4. 18.4. Creating a Sequential-Access Text File
      1. Class Record
      2. Using a Character Stream to Create an Output File
    5. 18.5. Reading Data from a Sequential-Access Text File
      1. Searching a Sequential-Access File
    6. 18.6. Serialization
    7. 18.7. Creating a Sequential-Access File Using Object Serialization
      1. Defining the RecordSerializable Class
      2. Using a Serialization Stream to Create an Output File
    8. 18.8. Reading and Deserializing Data from a Sequential Access Text File
    9. 18.9. Wrap-Up
    10. Summary
      1. Section 18.1 Introduction
      2. Section 18.2 Files and Streams
      3. Section 18.3 Classes File and Directory
      4. Section 18.4 Creating a Sequential-Access Text File
      5. Section 18.5 Reading Data from a Sequential-Access Text File
      6. Section 18.6 Serialization
      7. Section 18.7 Creating a Sequential-Access File Using Object Serialization
      8. Section 18.8 Reading and Deserializing Data from a Sequential-Access Text File
    11. Terminology
    12. Self-Review Exercises
    13. Answers to Self-Review Exercises
    14. Exercises
  24. 19. Class string and String Stream Processing
    1. 19.1. Introduction
    2. 19.2. string Assignment and Concatenation
    3. 19.3. Comparing strings
    4. 19.4. Substrings
    5. 19.5. Swapping strings
    6. 19.6. string Characteristics
    7. 19.7. Finding Substrings and Characters in a string
    8. 19.8. Replacing Characters in a string
    9. 19.9. Inserting Characters into a string
    10. 19.10. Conversion to C-Style Pointer-Based char * Strings
    11. 19.11. Iterators
    12. 19.12. String Stream Processing
    13. 19.13. Fundamentals of Characters and Strings in C++/CLI
    14. 19.14. String Constructors
    15. 19.15. String Indexer, Length Property and CopyTo Function
    16. 19.16. Comparing Strings
    17. 19.17. Locating Characters and Substrings in Strings
    18. 19.18. Extracting Substrings from Strings
    19. 19.19. Concatenating Strings
    20. 19.20. Miscellaneous String Functions
    21. 19.21. Class StringBuilder
    22. 19.22. StringBuilder Class Length, Capacity, EnsureCapacity and Indexer
    23. 19.23. StringBuilder Class Append and AppendFormat Functions
    24. 19.24. StringBuilder Class Insert, Remove and Replace Functions
    25. 19.25. Char Functions
    26. 19.26. Wrap-Up
    27. Summary
      1. Section 19.1 Introduction
      2. Section 19.2 string Assignment and Concatenation
      3. Section 19.3 Comparing strings
      4. Section 19.4 Substrings
      5. Section 19.5 Swapping strings
      6. Section 19.6 string Characteristics
      7. Section 19.7 Finding Substrings and Characters in a string
      8. Section 19.8 Replacing Characters in a string
      9. Section 19.9 Inserting Characters into a string
      10. Section 19.10 Conversion to C-Style Pointer-Based char * Strings
      11. Section 19.11 Iterators
      12. Section 19.12 String Stream Processing
      13. Section 19.13 Fundamentals of Characters and Strings in C++/CLI
      14. Section 19.14 String Constructors
      15. Section 19.15 String Indexer, Length Property, and CopyTo Function
      16. Section 19.16 Comparing Strings
      17. Section 19.17 Locating Characters and Substrings in Strings
      18. Section 19.18 Extracting Substrings from Strings
      19. Section 19.19 Concatenating Strings
      20. Section 19.20 Miscellaneous String Functions
      21. Section 19.21 Class StringBuilder
      22. Section 19.22 StringBuilder Class Length, Capacity, EnsureCapacity and Indexer
      23. Section 19.23 StringBuilder Class Append and AppendFormat Functions
      24. Section 19.24 StringBuilder Class Insert, Remove and Replace Functions
      25. Section 19.25 Char Functions
    28. Terminology
      1. C++ Terminology
      2. C++/CLI Terminology
    29. Self-Review Exercises
    30. Answers to Self-Review Exercises
    31. Exercises
  25. 20. Searching and Sorting
    1. 20.1. Introduction
    2. 20.2. Searching Algorithms
      1. 20.2.1. Efficiency of Linear Search
      2. 20.2.2. Binary Search
        1. Efficiency of Binary Search
    3. 20.3. Sorting Algorithms
      1. 20.3.1. Efficiency of Selection Sort
      2. 20.3.2. Efficiency of Insertion Sort
      3. 20.3.3. Merge Sort (A Recursive Implementation)
        1. Efficiency of Merge Sort
    4. 20.4. Wrap-Up
    5. Summary
      1. Section 20.1 Introduction
      2. Section 20.2 Searching Algorithms
      3. Section 20.2.1 Efficiency of Linear Search
      4. Section 20.2.2 Binary Search
      5. Section 20.3.1 Efficiency of Selection Sort
      6. Section 20.3.2 Efficiency of Insertion Sort
      7. Section 20.3.3 Merge Sort (A Recursive Implementation)
    6. Terminology
    7. Self-Review Exercises
    8. Answers to Self-Review Exercises
    9. Exercises
  26. 21. Data Structures
    1. 21.1. Introduction
    2. 21.2. Self-Referential Classes
    3. 21.3. Dynamic Memory Allocation and Data Structures
    4. 21.4. Linked Lists
      1. Linked-List Implementation
      2. Member Function insertAtFront
      3. Member Function insertAtBack
      4. Member Function removeFromFront
      5. Member Function removeFromBack
      6. Member Function print
      7. Linear and Circular Singly Linked and Doubly Linked Lists
    5. 21.5. Stacks
    6. 21.6. Queues
    7. 21.7. Trees
      1. Basic Terminology
      2. Binary Search Trees
      3. Implementing the Binary Search Tree Program
      4. Inorder Traversal Algorithm
      5. Preorder Traversal Algorithm
      6. Postorder Traversal Algorithm
      7. Duplicate Elimination
      8. Overview of the Binary Tree Exercises
    8. 21.8. Wrap-Up
    9. Summary
      1. Section 21.1 Introduction
      2. Section 21.2 Self-Referential Classes
      3. Section 21.3 Dynamic Memory Allocation and Data Structures
      4. Section 21.4 Linked Lists
      5. Section 21.5 Stacks
      6. Section 21.6 Queues
      7. Section 21.7 Trees
    10. Terminology
    11. Self-Review Exercises
    12. Answers to Self-Review Exercises
    13. Exercises
    14. Special Section: Building Your Own Compiler
      1. First Pass
      2. Second Pass
      3. A Complete Example
      4. A Step-by-Step View of the Compilation Process
  27. 22. Bits, Characters, C Strings and structs
    1. 22.1. Introduction
    2. 22.2. Structure Definitions
    3. 22.3. Initializing Structures
    4. 22.4. Using Structures with Functions
    5. 22.5. typedef
    6. 22.6. Example: High-Performance Card Shuffling and Dealing Simulation
    7. 22.7. Bitwise Operators
      1. Printing a Binary Representation of an Integral Value
      2. Bitwise AND Operator (&)
      3. Bitwise Inclusive OR Operator (|)
      4. Bitwise Exclusive OR (^)
      5. Bitwise Complement (~)
      6. Left-Shift Operator
      7. Right-Shift Operator
      8. Bitwise Assignment Operators
    8. 22.8. Bit Fields
    9. 22.9. Character-Handling Library Functions
    10. 22.10. Pointer-Based String-Conversion Functions
    11. 22.11. Search Functions of the Pointer-Based String-Handling Library
    12. 22.12. Memory Functions of the Pointer-Based String-Handling Library
    13. 22.13. Wrap-Up
    14. Summary
      1. Section 22.2 Structure Definitions
      2. Section 22.3 Initializing Structures
      3. Section 22.4 Using Structures with Functions
      4. Section 22.5 typedef
      5. Section 22.7 Bitwise Operators
      6. Section 22.8 Bit Fields
      7. Section 22.9 Character-Handling Library Functions
      8. Section 22.10 Pointer-Based String-Conversion Functions
      9. Section 22.11 Search Functions of the Pointer-Based String-Handling Library
      10. Section 22.12 Memory Functions of the Pointer-Based String-Handling Library
    15. Terminology
    16. Self-Review Exercises
    17. Answers to Self-Review Exercises
    18. Exercises
  28. 23. Standard Template Library (STL)
    1. 23.1. Introduction to the Standard Template Library (STL)
      1. 23.1.1. Introduction to Containers
        1. STL Containers Overview
        2. STL Container Common Functions
        3. STL Container Header Files
        4. First-Class Container Common typedefs
      2. 23.1.2. Introduction to Iterators
        1. Using istream_iterator for Input and Using ostream_iterator for Output
        2. Iterator Categories and Iterator Category Hierarchy
        3. Predefined Iterator typedefs
        4. Iterator Operations
      3. 23.1.3. Introduction to Algorithms
    2. 23.2. Sequence Containers
      1. 23.2.1. vector Sequence Container
        1. Using Vector and Iterators
        2. Vector Element-Manipulation Functions
      2. 23.2.2. list Sequence Container
      3. 23.2.3. deque Sequence Container
    3. 23.3. Associative Containers
      1. 23.3.1. multiset Associative Container
      2. 23.3.2. set Associative Container
      3. 23.3.3. multimap Associative Container
      4. 23.3.4. map Associative Container
    4. 23.4. Container Adapters
      1. 23.4.1. stack Adapter
      2. 23.4.2. queue Adapter
      3. 23.4.3. priority_queue Adapter
    5. 23.5. Algorithms
      1. 23.5.1. fill, fill_n, generate and generate_n
      2. 23.5.2. equal, mismatch and lexicographical_compare
      3. 23.5.3. remove, remove_if, remove_copy and remove_copy_if
      4. 23.5.4. replace, replace_if, replace_copy and replace_copy_if
      5. 23.5.5. Mathematical Algorithms
      6. 23.5.6. Basic Searching and Sorting Algorithms
      7. 23.5.7. swap, iter_swap and swap_ranges
      8. 23.5.8. copy_backward, merge, unique and reverse
      9. 23.5.9. inplace_merge, unique_copy and reverse_copy
      10. 23.5.10. Set Operations
      11. 23.5.11. lower_bound, upper_bound and equal_range
      12. 23.5.12. Heapsort
      13. 23.5.13. min and max
      14. 23.5.14. STL Algorithms Not Covered in This Chapter
    6. 23.6. Class bitset
      1. Sieve of Eratosthenes with bitset
    7. 23.7. Function Objects
      1. Predefined Function Objects of the Standard Template Library
      2. Using the STL Accumulate Algorithm
    8. 23.8. Introduction to STL/CLR
    9. 23.9. Wrap-Up
    10. 23.10. STL Web Resources
    11. Summary
      1. Section 23.1 Introduction to the Standard Template Library (STL)
      2. Section 23.1.1 Introduction to Containers
        1. Section 23.1.2 Introduction to Iterators
        2. Section 23.1.3 Introduction to Algorithms
      3. Section 23.2 Sequence Containers
        1. Section 23.2.1 vector Sequence Container
        2. Section 23.2.2 list Sequence Container
        3. Section 23.2.3 deque Sequence Container
      4. Section 23.3 Associative Containers
        1. Section 23.3.1 multiset Associative Container
        2. Section 23.3.2 set Associative Container
        3. Section 23.3.3 multimap Associative Container
        4. Section 23.3.4 map Associative Container
      5. Section 23.4 Container Adapters
        1. Section 23.4.1 stack Adapter
        2. Section 23.4.2 queue Adapter
        3. Section 23.4.3 priority_queue Adapter
        4. Section 23.5.1 fill, fill_n, generate and generate_n
        5. Section 23.5.2 equal, mismatch and lexicographical_compare
        6. Section 23.5.3 remove, remove_if, remove_copy and remove_copy_if
        7. Section 23.5.4 replace, replace_if, replace_copy and replace_copy_if
        8. Section 23.5.5 Mathematical Algorithms
        9. Section 23.5.6 Basic Searching and Sorting Algorithms
        10. Section 23.5.7 swap, iter_swap and swap_ranges
        11. Section 23.5.8 copy_backward, merge, unique and reverse
        12. Section 23.5.9 inplace_merge, unique_copy and reverse_copy
        13. Section 23.5.10 Set Operations
        14. Section 23.5.11 lower_bound, upper_bound and equal_range
        15. Section 23.5.12 Heapsort
        16. Section 23.5.13 min and max
      6. Section 23.6 Class bitset
      7. Section 23.7 Function Objects
      8. Section 23.8 Introduction to STL/CLR
    12. Terminology
    13. Self-Review Exercises
    14. Answers to Self-Review Exercises
    15. Exercises
    16. Recommended Reading
  29. 24. Regular Expressions
    1. 24.1. Introduction
    2. 24.2. Simple Regular Expressions and Class Regex
      1. Regular Expression Character Classes and Quantifiers
    3. 24.3. Complex Regular Expressions
    4. 24.4. Validating User Input with Regular Expressions
    5. 24.5. Regex Member Functions Replace and Split
    6. 24.6. Wrap-Up
    7. Summary
      1. Section 24.2 Regular Expressions and Class Regex
      2. Section 24.3 Complex Regular Expressions
      3. Section 24.4 Validating User Input with Regular Expressions
      4. Section 24.5 Regex Member Functions Replace and Split
    8. Terminology
    9. Self-Review Exercises
    10. Answers to Self-Review Exercises
    11. Exercises
  30. 25. Collections
    1. 25.1. Introduction
    2. 25.2. Collections Overview
    3. 25.3. Class Array and Enumerators
    4. 25.4. Nongeneric Collections
      1. 25.4.1. Class ArrayList
      2. 25.4.2. Class Stack
      3. 25.4.3. Class Hashtable
        1. Problems with Nongeneric Collections
    5. 25.5. Generic Collections
      1. 25.5.1. Generic Class SortedDictionary
      2. 25.5.2. Generic Class LinkedList
    6. 25.6. Wrap-Up
    7. Summary
      1. Section 25.1 Introduction
      2. Section 25.2 Collections Overview
      3. Section 25.3 Class Array and Enumerators
      4. Section 25.4.1 Class ArrayList
      5. Section 25.4.2 Class Stack
      6. Section 25.4.3 Class Hashtable
      7. Section 25.5.1 Generic Class SortedDictionary
      8. Section 25.5.2 Generic Class LinkedList
    8. Terminology
    9. Self-Review Exercises
    10. Answers to Self-Review Exercises
    11. Exercises
  31. 26. Other Topics
    1. 26.1. Introduction
    2. 26.2. Other Cast Operators
      1. const_cast
      2. Converting Between Pointer Types with the reinterpret_cast Operator
      3. safe_cast in C++/CLI
    3. 26.3. namespaces
      1. Using the std Namespace
      2. Defining Namespaces
      3. Accessing Namespace Members with Qualified Names
      4. Aliases for Namespace Names
    4. 26.4. Operator Keywords
    5. 26.5. mutable Class Members
      1. Mechanical Demonstration of a mutable Data Member
    6. 26.6. Pointers to Class Members (.* and ->*)
    7. 26.7. Multiple Inheritance
      1. Resolving Ambiguity Issues That Arise When a Derived Class Inherits Member Functions of the Same Name from Multiple Base Classes
      2. Demonstrating the Is-A Relationships in Multiple Inheritance
    8. 26.8. Multiple Inheritance and virtual Base Classes
      1. Compilation Errors Produced When Ambiguity Arises in Diamond Inheritance
      2. Eliminating Duplicate Subobjects with virtual Base-Class Inheritance
      3. Constructors in Multiple-Inheritance Hierarchies with virtual Base Classes
      4. Additional Information on Multiple Inheritance
    9. 26.9. Variable-Length Argument Lists
      1. Native C++
      2. C++/CLI
    10. 26.10. Using Command-Line Arguments
      1. Native C++
      2. C++/CLI
    11. 26.11. Delegates and Events in .NET
      1. MulticastDelegate
      2. Events
    12. 26.12. Wrap-Up
    13. Summary
      1. Section 26.2 Other Cast Operators
      2. Section 26.3 namespaces
      3. Section 26.4 Operator Keywords
      4. Section 26.5 mutable Class Members
      5. Section 26.6 Pointers to Class Members (.* and ->*)
      6. Section 26.7 Multiple Inheritance
      7. Section 26.8 Multiple Inheritance and virtual Base Classes
      8. Section 26.9 Variable-Length Argument Lists
      9. Section 26.10 Using Command-Line Arguments
      10. Section 26.11 Delegates and Events in .NET
    14. Terminology
    15. Self-Review Exercises
    16. Answers to Self-Review Exercises
    17. Exercises
  32. A. Operator Precedence and Associativity Chart
    1. A.1. Operator Precedence
  33. B. ASCII Character Set
  34. C. Fundamental Types
  35. D. Number Systems
    1. D.1. Introduction
    2. D.2. Abbreviating Binary Numbers as Octal and Hexadecimal Numbers
    3. D.3. Converting Octal and Hexadecimal Numbers to Binary Numbers
    4. D.4. Converting from Binary, Octal or Hexadecimal to Decimal
    5. D.5. Converting from Decimal to Binary, Octal or Hexadecimal
    6. D.6. Negative Binary Numbers: Two’s Complement Notation
    7. Summary
    8. Terminology
    9. Self-Review Exercises
    10. Answers to Self-Review Exercises
    11. Exercises
  36. E. Preprocessor
    1. E.1. Introduction
    2. E.2. The #include Preprocessor Directive
    3. E.3. The #define Preprocessor Directive: Symbolic Constants
    4. E.4. The #define Preprocessor Directive: Macros
    5. E.5. Conditional Compilation
    6. E.6. The #error and #pragma Preprocessor Directives
    7. E.7. Operators # and ##
    8. E.8. Predefined Symbolic Constants
    9. E.9. Assertions
    10. E.10. Wrap-Up
    11. Summary
      1. Section E.2 The #include Preprocessor Directive
      2. Section E.3 The #define Preprocessor Directive: Symbolic Constants
      3. Section E.4 The #define Preprocessor Directive: Macros
      4. Section E.5 Conditional Compilation
      5. Section E.6 The #error and #pragma Preprocessor Directives
      6. Section E.7 Operators # and ##
      7. Section E.8 Predefined Symbolic Constants
      8. Section E.9 Assertions
    12. Terminology
    13. Self-Review Exercises
    14. Answers to Self-Review Exercises
    15. Exercises
  37. F. ATM Case Study Code
    1. F.1. ATM Case Study Implementation
    2. F.2. Class ATM
      1. ATM Class Member-Function Definitions
    3. F.3. Class Screen
      1. Screen Class Member-Function Definitions
    4. F.4. Class Keypad
      1. Keypad Class Member-Function Definition
    5. F.5. Class CashDispenser
      1. CashDispenser Class Member-Function Definitions
    6. F.6. Class DepositSlot
    7. F.7. Class Account
      1. Account Class Member-Function Definitions
    8. F.8. Class BankDatabase
      1. BankDatabase Class Member-Function Definitions
    9. F.9. Class Transaction
    10. F.10. Class BalanceInquiry
    11. F.11. Class Withdrawal
      1. Withdrawal Class Member-Function Definitions
    12. F.12. Class Deposit
      1. Deposit Class Member-Function Definitions
    13. F.13. Test Program ATMCaseStudy.cpp
    14. F.14. Wrap-Up
  38. G. UML 2: Additional Diagram Types
    1. G.1. Introduction
    2. G.2. Additional Diagram Types
  39. H. Using the Visual Studio Debugger
    1. H.1. Introduction
    2. H.2. Breakpoints and the Continue Command
    3. H.3. Locals and Watch Windows
    4. H.4. Controlling Execution Using the Step Into, Step Over, Step Out and Continue Commands
    5. H.5. Autos Window
    6. H.6. Wrap-Up
    7. Summary
      1. Section H.1 Introduction
      2. Section H.2 Breakpoints and the Continue Command
      3. Section H.3 Locals and Watch Windows
      4. Section H.4 Controlling Execution Using the Using the Step Into, Step Over, Step Out and Continue Commands
      5. Section H.5 Autos Window
    8. Terminology
    9. Self-Review Exercises
    10. Answers to Self-Review Exercises