• Cover
  • Copyright
  • DeitelŪ Series Page
  • Deitel Resource Centers
  • Preface
  • Before You Begin
  • 1. Introduction
    • 1.1. Introduction
    • 1.2. History of C and C++
    • 1.3. C++ Standard Library
    • 1.4. Key Software Trend: Object Technology
    • 1.5. Typical C++ Development Environment
    • 1.6. Notes About C++ and C++ for Programmers
    • 1.7. Test-Driving a C++ Application
    • 1.8. Software Technologies
    • 1.9. Future of C++: Open Source Boost Libraries, TR1 and C++0x
    • 1.10. Software Engineering Case Study: Introduction to Object Technology and the UML
    • 1.11. Wrap-Up", "ch01lev1sec11.html
    • 1.12. Web Resources
  • 2. Introduction to C++ Programming
    • 2.1. Introduction
    • 2.2. First Program in C++: Printing a Line of Text
    • 2.3. Modifying Our First C++ Program
    • 2.4. Another C++ Program: Adding Integers
    • 2.5. Arithmetic
    • 2.6. Decision Making: Equality and Relational Operators
    • 2.7. (Optional) Software Engineering Case Study: Examining the ATM Requirements Specification
    • 2.8. Wrap-Up
  • 3. Introduction to Classes and Objects
    • 3.1. Introduction
    • 3.2. Classes, Objects, Member Functions and Data Members
    • 3.3. Overview of the Chapter Examples
    • 3.4. Defining a Class with a Member Function
    • 3.5. Defining a Member Function with a Parameter
    • 3.6. Data Members, set Functions and get Functions
    • 3.7. Initializing Objects with Constructors
    • 3.8. Placing a Class in a Separate File for Reusability
    • 3.9. Separating Interface from Implementation
    • 3.10. Validating Data with set Functions
    • 3.11. (Optional) Software Engineering Case Study: Identifying the Classes in the ATM Requirements Specification
    • 3.12. Wrap-Up
  • 4. Control Statements: Part 1
    • 4.1. Introduction
    • 4.2. Control Structures
    • 4.3. if Selection Statement
    • 4.4. if...else Double-Selection Statemen
    • 4.5. while Repetition Statement
    • 4.6. Counter-Controlled Repetition
    • 4.7. Sentinel-Controlled Repetition
    • 4.8. Nested Control Statements
    • 4.9. Assignment Operators
    • 4.10. Increment and Decrement Operators
    • 4.11. (Optional) Software Engineering Case Study: Identifying Class Attributes in the ATM System
    • 4.12. Wrap-Up
  • 5. Control Statements: Part 2
    • 5.1. Introduction
    • 5.2. Essentials of Counter-Controlled Repetition
    • 5.3. for Repetition Statement
    • 5.4. Examples Using the for Statement
    • 5.5. do...while Repetition Statement
    • 5.6. switch Multiple-Selection Statement
    • 5.7. break and continue Statements
    • 5.8. Logical Operators
    • 5.9. Confusing the Equality (==) and Assignment (=) Operators
    • 5.10. (Optional) Software Engineering Case Study: Identifying Objects' States and Activities in the ATM System
    • 5.11. Wrap-Up
  • 6. Functions and an Introduction to Recursion
    • 6.1. Introduction
    • 6.2. Program Components in C++
    • 6.3. Math Library Functions
    • 6.4. Function Definitions with Multiple Parameters
    • 6.5. Function Prototypes and Argument Coercion
    • 6.6. C++ Standard Library Header Files
    • 6.7. Case Study: Random Number Generation
    • 6.8. Case Study: Game of Chance; Introducing enum
    • 6.9. Storage Classes
    • 6.10. Scope Rules
    • 6.11. Function Call Stack and Activation Records
    • 6.12. Functions with Empty Parameter Lists
    • 6.13. Inline Functions
    • 6.14. References and Reference Parameters
    • 6.15. Default Arguments
    • 6.16. Unary Scope Resolution Operator
    • 6.17. Function Overloading
    • 6.18. Function Templates
    • 6.19. Recursion
    • 6.20. Example Using Recursion: Fibonacci Series
    • 6.21. Recursion vs. Iteration
    • 6.22. (Optional) Software Engineering Case Study: Identifying Class Operations in the ATM System
    • 6.23. Wrap-Up
  • 7. Arrays and Vectors
    • 7.1. Introduction
    • 7.2. Arrays
    • 7.3. Declaring Arrays
    • 7.4. Examples Using Arrays
    • 7.5. Passing Arrays to Functions
    • 7.6. Case Study: Class GradeBook Using an Array to Store Grades
    • 7.7. Searching Arrays with Linear Search
    • 7.8. Sorting Arrays with Insertion Sort
    • 7.9. Multidimensional Arrays
    • 7.10. Case Study: Class GradeBook Using a Two-Dimensional Array
    • 7.11. Introduction to C++ Standard Library Class Template vector
    • 7.12. (Optional) Software Engineering Case Study: Collaboration Among Objects in the ATM System
    • 7.13. Wrap-Up
  • 8. Pointers and Pointer-Based Strings
    • 8.1. Introduction
    • 8.2. Pointer Variable Declarations and Initialization
    • 8.3. Pointer Operators
    • 8.4. Passing Arguments to Functions by Reference with Pointers
    • 8.5. Using const with Pointers
    • 8.6. Selection Sort Using Pass-by-Reference
    • 8.7. sizeof Operator
    • 8.8. Pointer Expressions and Pointer Arithmetic
    • 8.9. Relationship Between Pointers and Arrays
    • 8.10. Arrays of Pointers
    • 8.11. Case Study: Card Shuffling and Dealing Simulation
    • 8.12. Function Pointers
    • 8.13. Introduction to Pointer-Based String Processing
    • 8.14. Wrap-Up
  • 9. Classes: A Deeper Look, Part 1
    • 9.1. Introduction
    • 9.2. Time Class Case Study
    • 9.3. Class Scope and Accessing Class Members
    • 9.4. Separating Interface from Implementation
    • 9.5. Access Functions and Utility Functions
    • 9.6. Time Class Case Study: Constructors with Default Arguments
    • 9.7. Destructors
    • 9.8. When Constructors and Destructors Are Called
    • 9.9. Time Class Case Study: A Subtle Trap - Returning a Reference to a private Data Member
    • 9.10. Default Memberwise Assignment
    • 9.11. (Optional) Software Engineering Case Study: Starting to Program the Classes of the ATM System
    • 9.12. Wrap-Up
  • 10. Classes: A Deeper Look, Part 2
    • 10.1. Introduction
    • 10.2. const (Constant) Objects and const Member Functions
    • 10.3. Composition: Objects as Members of Classes
    • 10.4. friend Functions and friend Classes
    • 10.5. Using the this Pointer
    • 10.6. Dynamic Memory Management with Operators new and delete
    • 10.7. static Class Members
    • 10.8. Data Abstraction and Information Hiding
    • 10.9. Container Classes and Iterators
    • 10.10. Proxy Classes
    • 10.11. Wrap-Up
  • 11. Operator Overloading; String and Array Objects
    • 11.1. Introduction
    • 11.2. Fundamentals of Operator Overloading
    • 11.3. Restrictions on Operator Overloading
    • 11.4. Operator Functions as Class Members vs. Global Functions
    • 11.5. Overloading Stream Insertion and Stream Extraction Operators
    • 11.6. Overloading Unary Operators
    • 11.7. Overloading Binary Operators
    • 11.8. Case Study: Array Class
    • 11.9. Converting between Types
    • 11.10. Case Study: String Class
    • 11.11. Overloading ++ and --
    • 11.12. Case Study: A Date Class
    • 11.13. Standard Library Class string
    • 11.14. explicit Constructors
    • 11.15. Wrap-Up
  • 12. Object-Oriented Programming: Inheritance
    • 12.1. Introduction
    • 12.2. Base Classes and Derived Classes
    • 12.3. protected Members
    • 12.4. Relationship between Base Classes and Derived Classes
    • 12.5. Constructors and Destructors in Derived Classes
    • 12.6. public, protected and private Inheritance
    • 12.7. Software Engineering with Inheritance
    • 12.8. Wrap-Up
  • 13. Object-Oriented Programming: Polymorphism
    • 13.1. Introduction
    • 13.2. Polymorphism Examples
    • 13.3. Relationships Among Objects in an Inheritance Hierarchy
    • 13.4. Type Fields and switch Statements
    • 13.5. Abstract Classes and Pure virtual Functions
    • 13.6. Case Study: Payroll System Using Polymorphism
    • 13.7. (Optional) Polymorphism, Virtual Functions and Dynamic Binding "Under the Hood
    • 13.8. Case Study: Payroll System Using Polymorphism and Runtime Type Information with Downcasting, dynamic_cast, typeid and type_info
    • 13.9. Virtual Destructors
    • 13.10. (Optional) Software Engineering Case Study: Incorporating Inheritance into the ATM System
    • 13.11. Wrap-Up
  • 14. Templates
    • 14.1. Introduction
    • 14.2. Function Templates
    • 14.3. Overloading Function Templates
    • 14.4. Class Templates
    • 14.5. Nontype Parameters and Default Types for Class Templates
    • 14.6. Notes on Templates and Inheritance
    • 14.7. Notes on Templates and Friends
    • 14.8. Notes on Templates and static Members
    • 14.9. Wrap-Up
  • 15. Stream Input/Output
    • 15.1. Introduction
    • 15.2. Streams
    • 15.3. Stream Output
    • 15.4. Stream Input
    • 15.5. Unformatted I/O Using read, write and gcount
    • 15.6. Introduction to Stream Manipulators
    • 15.7. Stream Format States and Stream Manipulators
    • 15.8. Stream Error States
    • 15.9. Tying an Output Stream to an Input Stream
    • 15.10. Wrap-Up
  • 16. Exception Handling
    • 16.1. Introduction
    • 16.2. Exception-Handling Overview
    • 16.3. Example: Handling an Attempt to Divide by Zero
    • 16.4. When to Use Exception Handling
    • 16.5. Rethrowing an Exception
    • 16.6. Exception Specifications
    • 16.7. Processing Unexpected Exceptions
    • 16.8. Stack Unwinding
    • 16.9. Constructors, Destructors and Exception Handling
    • 16.10. Exceptions and Inheritance
    • 16.11. Processing new Failures
    • 16.12. Class auto_ptr and Dynamic Memory Allocation
    • 16.13. Standard Library Exception Hierarchy
    • 16.14. Other Error-Handling Techniques
    • 16.15. Wrap-Up
  • 17. File Processing
    • 17.1. Introduction
    • 17.2. Data Hierarchy
    • 17.3. Files and Streams
    • 17.4. Creating a Sequential File
    • 17.5. Reading Data from a Sequential File
    • 17.6. Updating Sequential Files
    • 17.7. Random-Access Files
    • 17.8. Creating a Random-Access File
    • 17.9. Writing Data Randomly to a Random-Access File
    • 17.10. Reading from a Random-Access File Sequentially
    • 17.11. Case Study: A Transaction-Processing Program
    • 17.12. Overview of Object Serialization
    • 17.13. Wrap-Up
  • 18. Class string and String Stream Processing
    • 18.1. Introduction
    • 18.2. string Assignment and Concatenation
    • 18.3. Comparing strings
    • 18.4. Substrings
    • 18.5. Swapping strings
    • 18.6. string Characteristics
    • 18.7. Finding Substrings and Characters in a string
    • 18.8. Replacing Characters in a string
    • 18.9. Inserting Characters into a string
    • 18.10. Conversion to C-Style Pointer-Based char * Strings
    • 18.11. Iterators
    • 18.12. String Stream Processing
    • 18.13. Wrap-Up
  • 19. Bits, Characters, C Strings and structs
    • 19.1. Introduction
    • 19.2. Structure Definitions
    • 19.3. Initializing Structures
    • 19.4. Using Structures with Functions
    • 19.5. typedef
    • 19.6. Example: High-Performance Card Shuffling and Dealing Simulation
    • 19.7. Bitwise Operators
    • 19.8. Bit Fields
    • 19.9. Character-Handling Library
    • 19.10. Pointer-Based String-Conversion Functions
    • 19.11. Search Functions of the Pointer-Based String-Handling Library
    • 19.12. Memory Functions of the Pointer-Based String-Handling Library
    • 19.13. Wrap-Up
  • 20. Standard Template Library (STL)
    • 20.1. Introduction to the Standard Template Library (STL)
    • 20.2. Sequence Containers
    • 20.3. Associative Containers
    • 20.4. Container Adapters
    • 20.5. Algorithms
    • 20.6. Class bitset
    • 20.7. Function Objects
    • 20.8. Wrap-Up
    • 20.9. STL Web Resources
  • 21. Boost Libraries, Technical Report 1 and C++0x
    • 21.1. Introduction
    • 21.2. Deitel Online C++ and Related Resource Centers
    • 21.3. Boost Libraries
    • 21.4. Adding a New Library to Boost
    • 21.5. Installing the Boost Libraries
    • 21.6. Boost Libraries in Technical Report 1 (TR1)
    • 21.7. Regular Expressions with the Boost.Regex Library
    • 21.8. Smart Pointers with Boost.Smart_ptr
    • 21.9. Technical Report 1
    • 21.10. C++0x
    • 21.11. Core Language Changes
    • 21.12. Wrap-Up
  • 22. Other Topics
    • 22.1. Introduction
    • 22.2. const_cast Operator
    • 22.3. namespaces
    • 22.4. Operator Keywords
    • 22.5. mutable Class Members
    • 22.6. Pointers to Class Members (.* and ->*)
    • 22.7. Multiple Inheritance
    • 22.8. Multiple Inheritance and virtual Base Classes
    • 22.9. Wrap-Up
  • A. Operator Precedence and Associativity Chart
    • A.1. Operator Precedence
  • B. ASCII Character Set
  • C. Fundamental Types
  • D. Preprocessor
    • D.1. Introduction
    • D.2. The #include Preprocessor Directive
    • D.3. The #define Preprocessor Directive: Symbolic Constants
    • D.4. The #define Preprocessor Directive: Macros
    • D.5. Conditional Compilation
    • D.6. The #error and #pragma Preprocessor Directives
    • D.7. Operators # and ##
    • D.8. Predefined Symbolic Constants
    • D.9. Assertions
    • D.10. Wrap-Up
  • E. ATM Case Study Code
    • E.1. ATM Case Study Implementation
    • E.2. Class ATM
    • E.3. Class Screen
    • E.4. Class Keypad
    • E.5. Class CashDispenser
    • E.6. Class DepositSlot
    • E.7. Class Account
    • E.8. Class BankDatabase
    • E.9. Class Transaction
    • E.10. Class BalanceInquiry
    • E.11. Class Withdrawal
    • E.12. Class Deposit
    • E.13. Test Program ATMCaseStudy.cpp
    • E.14. Wrap-Up
  • F. UML 2: Additional Diagram Types
    • F.1. Introduction
    • F.2. Additional Diagram Types
  • G. Using the Visual Studio Debugger
    • G.1. Introduction
    • G.2. Breakpoints and the Continue Command
    • G.3. Locals and Watch Windows
    • G.4. Controlling Execution Using the Step Into, Step Over, Step Out and Continue Commands
    • G.5. Autos Window
    • G.6. Wrap-Up
  • H. Using the GNU C++ Debugger
    • H.1. Introduction
    • H.2. Breakpoints and the run, stop, continue and print Commands
    • H.3. print and set Commands
    • H.4. Controlling Execution Using the step, finish and next Commands
    • H.5. watch Command
    • H.6. Wrap-Up
  • Bibliography
  • Index