| |
| |
Introduction | |
| |
| |
| |
Getting Started with C++ | |
| |
| |
Learning C++: What Lies Before You | |
| |
| |
The Origins of C++: A Little History | |
| |
| |
Portability and Standards | |
| |
| |
The Mechanics of Creating a Program | |
| |
| |
Summary | |
| |
| |
| |
Setting Out to C++ | |
| |
| |
C++ Initiation | |
| |
| |
C++ Statements | |
| |
| |
More C++ Statements | |
| |
| |
Functions | |
| |
| |
Summary | |
| |
| |
Chapter Review | |
| |
| |
Programming Exercises | |
| |
| |
| |
Dealing with Data | |
| |
| |
Simple Variables | |
| |
| |
The const Qualifier | |
| |
| |
Floating-Point Numbers | |
| |
| |
C++ Arithmetic Operators | |
| |
| |
Summary | |
| |
| |
Chapter Review | |
| |
| |
Programming Exercises | |
| |
| |
| |
Compound Types | |
| |
| |
Introducing Arrays | |
| |
| |
Strings | |
| |
| |
Introducing the string Class | |
| |
| |
Introducing Structures | |
| |
| |
Unions | |
| |
| |
Enumerations | |
| |
| |
Pointers and the Free Store | |
| |
| |
Pointers, Arrays, and Pointer Arithmetic | |
| |
| |
Combinations of Types | |
| |
| |
Array Alternatives | |
| |
| |
Summary | |
| |
| |
Chapter Review | |
| |
| |
Programming Exercises | |
| |
| |
| |
Loops and Relational Expressions | |
| |
| |
Introducing for Loops | |
| |
| |
The while Loop | |
| |
| |
The do while Loop | |
| |
| |
The Range-Based for Loop (C++11) | |
| |
| |
Loops and Text Input | |
| |
| |
Nested Loops and Two-Dimensional Arrays | |
| |
| |
Summary | |
| |
| |
Chapter Review | |
| |
| |
Programming Exercises | |
| |
| |
| |
Branching Statements and Logical Operators | |
| |
| |
The if Statement | |
| |
| |
Logical Expressions | |
| |
| |
The cctype Library of Character Functions | |
| |
| |
The ?: Operator | |
| |
| |
The switch Statement | |
| |
| |
The break and continue Statements | |
| |
| |
Number-Reading Loops | |
| |
| |
Simple File Input/Output | |
| |
| |
Summary | |
| |
| |
Chapter Review | |
| |
| |
Programming Exercises | |
| |
| |
| |
Functions: C++'s Programming Modules | |
| |
| |
Function Review | |
| |
| |
Function Arguments and Passing by Value | |
| |
| |
Functions and Arrays | |
| |
| |
Functions and Two-Dimensional Arrays | |
| |
| |
Functions and C-Style Strings | |
| |
| |
Functions and Structures | |
| |
| |
Functions and string Class Objects | |
| |
| |
Functions and array Objects | |
| |
| |
Recursion | |
| |
| |
Pointers to Functions | |
| |
| |
Summary | |
| |
| |
Chapter Review | |
| |
| |
Programming Exercises | |
| |
| |
| |
Adventures in Functions | |
| |
| |
C++ Inline Functions | |
| |
| |
Reference Variables | |
| |
| |
Default Arguments | |
| |
| |
Function Overloading | |
| |
| |
Function Templates | |
| |
| |
Summary | |
| |
| |
Chapter Review | |
| |
| |
Programming Exercises | |
| |
| |
| |
Memory Models and Namespaces | |
| |
| |
Separate Compilation | |
| |
| |
Storage Duration, Scope, and Linkage | |
| |
| |
Namespaces | |
| |
| |
Summary | |
| |
| |
Chapter Review | |
| |
| |
Programming Exercises | |
| |
| |
| |
Objects and Classes | |
| |
| |
Procedural and Object-Oriented Programming | |
| |
| |
Abstraction and Classes | |
| |
| |
Class Constructors and Destructors | |
| |
| |
Knowing Your Objects: The this Pointer | |
| |
| |
An Array of Objects | |
| |
| |
Class Scope | |
| |
| |
Abstract Data Types | |
| |
| |
Summary | |
| |
| |
Chapter Review | |
| |
| |
Programming Exercises | |
| |
| |
| |
Working with Classes | |
| |
| |
Operator Overloading | |
| |
| |
Time on Our Hands: Developing an Operator Overloading Example | |
| |
| |
Introducing Friends | |
| |
| |
Overloaded Operators: Member Versus Nonmember Functions | |
| |
| |
More Overloading: A Vector Class | |
| |
| |
Automatic Conversions and Type Casts for Classes | |
| |
| |
Summary | |
| |
| |
Chapter Review | |
| |
| |
Programming Exercises | |
| |
| |
| |
Classes and Dynamic Memory Allocation | |
| |
| |
Dynamic Memory and Classes | |
| |
| |
The New, Improved String Class | |
| |
| |
Things to Remember When Using new in Constructors | |
| |
| |
Observations About Returning Objects | |
| |
| |
Using Pointers to Objects | |
| |
| |
Reviewing Techniques | |
| |
| |
A Queue Simulation | |
| |
| |
Summary | |
| |
| |
Chapter Review | |
| |
| |
Programming Exercises | |
| |
| |
| |
Class Inheritance | |
| |
| |
Beginning with a Simple Base Class | |
| |
| |
Inheritance: AnIs-aRelationship | |
| |
| |
Polymorphic Public Inheritance | |
| |
| |
Static and Dynamic Binding | |
| |
| |
Access Control: protected | |
| |
| |
Abstract Base Classes | |
| |
| |
Inheritance and Dynamic Memory Allocation | |
| |
| |
Class Design Review | |
| |
| |
Summary | |
| |
| |
Chapter Review | |
| |
| |
Programming Exercises | |
| |
| |
| |
Reusing Code in C++ | |
| |
| |
Classes with Object Members | |
| |
| |
Private Inheritance | |
| |
| |
Multiple Inheritance | |
| |
| |
Class Templates | |
| |
| |
Summary | |
| |
| |
Chapter Review | |
| |
| |
Programming Exercises | |
| |
| |
| |
Friends, Exceptions, and More | |
| |
| |
Friends | |
| |
| |
Nested Classes | |
| |
| |
Exceptions | |
| |
| |
Runtime Type Identification | |
| |
| |
Type Cast Operators | |
| |
| |
Summary | |
| |
| |
Chapter Review | |
| |
| |
Programming Exercises | |
| |
| |
| |
The string Class and the Standard Template Library | |
| |
| |
The string Class | |
| |
| |
Smart Pointer Template Classes | |
| |
| |
The Standard Template Library | |
| |
| |
Generic Programming | |
| |
| |
Function Objects (a.k.a. Functors) | |
| |
| |
Algorithms | |
| |
| |
Other Libraries | |
| |
| |
| |
Input, Output, and Files | |
| |
| |
An Overview of C++ Input and Output | |
| |
| |
Output with cout | |
| |
| |
Input with cin | |
| |
| |
File Input and Output | |
| |
| |
Incore Formatting | |
| |
| |
Summary | |
| |
| |
Chapter Review | |
| |
| |
Programming Exercises | |
| |
| |
| |
Visiting with the New C++ Standard | |
| |
| |
C++11 Features Revisited | |
| |
| |
Move Semantics and the Rvalue Reference | |
| |
| |
New Class Features | |
| |
| |
Lambda Functions | |
| |
| |
Wrappers | |
| |
| |
Variadic Templates | |
| |
| |
More C++11 Features | |
| |
| |
Language Change | |
| |
| |
What Now? | |
| |
| |
Summary | |
| |
| |
Chapter Review | |
| |
| |
Programming Exercises | |
| |
| |
Appendixes | |
| |
| |
| |
Number Bases | |
| |
| |
| |
C++ Reserved Words | |
| |
| |
| |
The ASCII Character Set | |
| |
| |
| |
Operator Precedence | |
| |
| |
| |
Other Operators | |
| |
| |
| |
The stringTemplate Class | |
| |
| |
| |
The Standard Template Library Methods and Functions | |
| |
| |
| |
Selected Readings and Internet Resources | |
| |
| |
| |
Converting to ISO Standard C++ | |
| |
| |
| |
Answers to Chapter Reviews | |
| |
| |
Index | |