| |
| |
Preface | |
| |
| |
| |
The Story of C++ | |
| |
| |
The Origins of C++ | |
| |
| |
The Evolution of C++ | |
| |
| |
What Is Object-Oriented Programming? | |
| |
| |
| |
An Overview of C++ | |
| |
| |
Your First C++ Program | |
| |
| |
Handling Syntax Errors | |
| |
| |
A Second Simple Program | |
| |
| |
A More Practical Example | |
| |
| |
A New Data Type | |
| |
| |
A Quick Review | |
| |
| |
Functions | |
| |
| |
Function Arguments | |
| |
| |
Some Output Options | |
| |
| |
Two Simple Commands | |
| |
| |
Blocks of Code | |
| |
| |
Semicolons and Positioning | |
| |
| |
Indentation Practices | |
| |
| |
C++ Keywords | |
| |
| |
Identifiers in C++ | |
| |
| |
The Standard C++ Library | |
| |
| |
| |
The Basic Data Types | |
| |
| |
Declaration of Variables | |
| |
| |
Some Type Modifiers | |
| |
| |
Literals | |
| |
| |
Variable Initializations | |
| |
| |
Operators | |
| |
| |
Expressions | |
| |
| |
| |
Program Control Statements | |
| |
| |
The if Statement | |
| |
| |
The for Loop | |
| |
| |
The switch Statement | |
| |
| |
The while Loop | |
| |
| |
The do-while Loop | |
| |
| |
Using continue | |
| |
| |
Using break to Exit Loops | |
| |
| |
Nested Loops | |
| |
| |
Using the goto Statement | |
| |
| |
Putting Together the Pieces | |
| |
| |
| |
Arrays and Strings | |
| |
| |
One-Dimensional Arrays | |
| |
| |
Strings | |
| |
| |
Some String Library Functions | |
| |
| |
Two-Dimensional Arrays | |
| |
| |
Multidimensional Arrays | |
| |
| |
Array Initialization | |
| |
| |
Arrays of Strings | |
| |
| |
| |
Pointers | |
| |
| |
What Are Pointers? | |
| |
| |
The Pointer Operators | |
| |
| |
Pointer Expressions | |
| |
| |
Pointers and Arrays | |
| |
| |
Pointers and String Literals | |
| |
| |
A Comparison Example | |
| |
| |
Arrays of Pointers | |
| |
| |
The Null Pointer Convention | |
| |
| |
Multiple Indirection | |
| |
| |
Problems with Pointers | |
| |
| |
| |
Functions, Part One: The Fundamentals | |
| |
| |
Scope Rules of Functions | |
| |
| |
Passing Pointers and Arrays | |
| |
| |
Argc and argv: Arguments to main() | |
| |
| |
The return Statement | |
| |
| |
Function Prototypes | |
| |
| |
Headers: A Closer Look | |
| |
| |
Recursion | |
| |
| |
| |
Functions, Part Two: References, Overloading, and Default Arguments | |
| |
| |
Two Approaches to Argument Passing | |
| |
| |
Reference Parameters | |
| |
| |
Function Overloading | |
| |
| |
Default Function Arguments | |
| |
| |
Function Overloading and Ambiguity | |
| |
| |
| |
More Data Types and Operators | |
| |
| |
The const and volatile Qualifiers | |
| |
| |
Storage Class Specifiers | |
| |
| |
Enumerations | |
| |
| |
Typedef | |
| |
| |
More Operators | |
| |
| |
Bitwise Operators | |
| |
| |
The ? Operator | |
| |
| |
Compound Assignment | |
| |
| |
The Comma Operator | |
| |
| |
Multiple Assignments | |
| |
| |
Using sizeof | |
| |
| |
Dynamic Allocation Using new and delete | |
| |
| |
Precedence Summary | |
| |
| |
| |
Structures and Unions | |
| |
| |
Structures | |
| |
| |
Unions | |
| |
| |
Using sizeof to Ensure Portability | |
| |
| |
Moving On to Object-Oriented Programming | |
| |
| |
| |
Introducing the Class | |
| |
| |
Class Fundamentals | |
| |
| |
A Closer Look at Class Member Access | |
| |
| |
Constructors and Destructors | |
| |
| |
Classes and Structures Are Related | |
| |
| |
Unions and Classes Are Related | |
| |
| |
Inline Functions | |
| |
| |
Arrays of Objects | |
| |
| |
Pointers to Objects | |
| |
| |
Object References | |
| |
| |
| |
A Closer Look at Classes | |
| |
| |
Friend Functions | |
| |
| |
Overloading Constructors | |
| |
| |
Dynamic Initialization | |
| |
| |
Assigning Objects | |
| |
| |
Passing Objects to Functions | |
| |
| |
Returning Objects | |
| |
| |
Creating and Using a Copy Constructor | |
| |
| |
The this Keyword | |
| |
| |
| |
Operator Overloading | |
| |
| |
Operator Overloading Using Member Functions | |
| |
| |
Nonmember Operator Functions | |
| |
| |
A Closer Look at the Assignment Operator | |
| |
| |
Overloading [] | |
| |
| |
Overloading () | |
| |
| |
Overloading Other Operators | |
| |
| |
Another Example of Operator Overloading | |
| |
| |
| |
Inheritance | |
| |
| |
Introducing Inheritance | |
| |
| |
Base Class Access Control | |
| |
| |
Using protected Members | |
| |
| |
Inheriting Multiple Base Classes | |
| |
| |
Constructors, Destructors, and Inheritance | |
| |
| |
Granting Access | |
| |
| |
Virtual Base Classes | |
| |
| |
| |
Virtual Functions and Polymorphism | |
| |
| |
Pointers to Derived Types | |
| |
| |
Virtual Functions | |
| |
| |
Early versus Late Binding | |
| |
| |
| |
Templates | |
| |
| |
Generic Functions | |
| |
| |
Generic Classes | |
| |
| |
| |
Exception Handling | |
| |
| |
Exception Handling Fundamentals | |
| |
| |
Options for Exception Handling | |
| |
| |
Handling Exceptions Thrown by new | |
| |
| |
Overloading new and delete | |
| |
| |
| |
The C++ I/O System | |
| |
| |
Old VS Modern C++ I/O | |
| |
| |
C++ Streams | |
| |
| |
The C++ Stream Classes | |
| |
| |
Overloading the I/O Operators | |
| |
| |
Formatted I/O | |
| |
| |
File I/O | |
| |
| |
More Binary I/O Functions | |
| |
| |
Random Access | |
| |
| |
Checking I/O Status | |
| |
| |
Customized I/O and Files | |
| |
| |
| |
Run-Time Type ID and the Casting Operators | |
| |
| |
Run-Time Type Identification (RTTI) | |
| |
| |
The Casting Operators | |
| |
| |
| |
Namespaces and Other Advanced Topics | |
| |
| |
Namespaces | |
| |
| |
The std Namespace | |
| |
| |
Pointers to Functions | |
| |
| |
Static Class Members | |
| |
| |
Const Member Functions and mutable | |
| |
| |
Explicit Constructors | |
| |
| |
The Member Initialization Syntax | |
| |
| |
Using the asm Keyword | |
| |
| |
Linkage Specification | |
| |
| |
The .* and [characters not reproducible]* Pointer-to-Member Operators | |
| |
| |
Creating Conversion Functions | |
| |
| |
| |
Introducing the Standard Template Library | |
| |
| |
An Overview of the STL | |
| |
| |
The Container Classes | |
| |
| |
Vectors | |
| |
| |
Lists | |
| |
| |
Maps | |
| |
| |
Algorithms | |
| |
| |
The string Class | |
| |
| |
Final Thoughts on the STL | |
| |
| |
| |
The C++ Preprocessor | |
| |
| |
#define | |
| |
| |
#error | |
| |
| |
#include | |
| |
| |
Conditional Compilation Directives | |
| |
| |
#line | |
| |
| |
#pragma | |
| |
| |
The # and ## Preprocessor Operators | |
| |
| |
Predefined Macro Names | |
| |
| |
Final Thoughts | |
| |
| |
| |
C-Based I/O | |
| |
| |
C I/O Uses Streams | |
| |
| |
Understanding printf() and scanf() | |
| |
| |
The C File System | |
| |
| |
fseek() and Random-Access I/O | |
| |
| |
fprintf() and fscanf() | |
| |
| |
Erasing Files | |
| |
| |
| |
Working with an Older C++ Compiler | |
| |
| |
| |
The .NET Managed Extensions to C++ | |
| |
| |
The .NET Keyword Extensions | |
| |
| |
Preprocessor Extensions | |
| |
| |
The attribute Attribute | |
| |
| |
Compiling Managed C++ | |
| |
| |
Index | |