
Table of Contents






Chapter 1.
Getting Started

Section 1.1.
Writing a Simple C++ Program

Section 1.2.
A First Look at Input/Output

Section 1.3.
A Word About Comments

Section 1.4.
Control Structures

Section 1.5.
Introducing Classes

Section 1.6.
The C++ Program



Part I:
The Basics

Chapter 2.
Variables and Basic Types

Section 2.1.
Primitive Built-in Types

Section 2.2.
Literal Constants

Section 2.3.
Variables

Section 2.4.
const Qualifier

Section 2.5.
References

Section 2.6.
Typedef Names

Section 2.7.
Enumerations

Section 2.8.
Class Types

Section 2.9.
Writing Our Own Header Files



Chapter 3.
Library Types

Section 3.1.
Namespace using Declarations

Section 3.2.
Library string Type

Section 3.3.
Library vector Type

Section 3.4.
Introducing Iterators

Section 3.5.
Library bitset Type



Chapter 4.
Arrays and Pointers

Section 4.1.
Arrays

Section 4.2.
Introducing Pointers

Section 4.3.
C-Style Character Strings

Section 4.4.
Multidimensioned Arrays



Chapter 5.
Expressions

Section 5.1.
Arithmetic Operators

Section 5.2.
Relational and Logical Operators

Section 5.3.
The Bitwise Operators

Section 5.4.
Assignment Operators

Section 5.5.
Increment and Decrement Operators

Section 5.6.
The Arrow Operator

Section 5.7.
The Conditional Operator

Section 5.8.
The sizeof Operator

Section 5.9.
Comma Operator

Section 5.10.
Evaluating Compound Expressions

Section 5.11.
The new and delete Expressions

Section 5.12.
Type Conversions



Chapter 6.
Statements

Section 6.1.
Simple Statements

Section 6.2.
Declaration Statements

Section 6.3.
Compound Statements (Blocks)

Section 6.4.
Statement Scope

Section 6.5.
The if Statement

Section 6.6.
The switch Statement

Section 6.7.
The while Statement

Section 6.8.
The for Loop Statement

Section 6.9.
The do while Statement

Section 6.10.
The break Statement

Section 6.11.
The continue Statement

Section 6.12.
The goto Statement

Section 6.13.
try Blocks and Exception Handling

Section 6.14.
Using the Preprocessor for Debugging



Chapter 7.
Functions

Section 7.1.
Defining a Function

Section 7.2.
Argument Passing

Section 7.3.
The return Statement

Section 7.4.
Function Declarations

Section 7.5.
Local Objects

Section 7.6.
Inline Functions

Section 7.7.
Class Member Functions

Section 7.8.
Overloaded Functions

Section 7.9.
Pointers to Functions



Chapter 8.
The IO Library

Section 8.1.
An Object-Oriented Library

Section 8.2.
Condition States

Section 8.3.
Managing the Output Buffer

Section 8.4.
File Input and Output

Section 8.5.
String Streams



Part II:
Containers and Algorithms

Chapter 9.
Sequential Containers

Section 9.1.
Defining a Sequential Container

Section 9.2.
Iterators and Iterator Ranges

Section 9.3.
Sequence Container Operations

Section 9.4.
How a vector Grows

Section 9.5.
Deciding Which Container to Use

Section 9.6.
strings Revisited

Section 9.7.
Container Adaptors



Chapter 10.
Associative Containers

Section 10.1.
Preliminaries: the pair Type

Section 10.2.
Associative Containers

Section 10.3.
The map Type

Section 10.4.
The set Type

Section 10.5.
The multimap and multiset Types

Section 10.6.
Using Containers: Text-Query Program



Chapter 11.
Generic Algorithms

Section 11.1.
Overview

Section 11.2.
A First Look at the Algorithms

Section 11.3.
Revisiting Iterators

Section 11.4.
Structure of Generic Algorithms

Section 11.5.
Container-Specific Algorithms



Part III:
Classes and Data Abstraction

Chapter 12.
Classes

Section 12.1.
Class Definitions and Declarations

Section 12.2.
The Implicit this Pointer

Section 12.3.
Class Scope

Section 12.4.
Constructors

Section 12.5.
Friends

Section 12.6.
static Class Members



Chapter 13.
Copy Control

Section 13.1.
The Copy Constructor

Section 13.2.
The Assignment Operator

Section 13.3.
The Destructor

Section 13.4.
A Message-Handling Example

Section 13.5.
Managing Pointer Members



Chapter 14.
Overloaded Operations and Conversions

Section 14.1.
Defining an Overloaded Operator

Section 14.2.
Input and Output Operators

Section 14.3.
Arithmetic and Relational Operators

Section 14.4.
Assignment Operators

Section 14.5.
Subscript Operator

Section 14.6.
Member Access Operators

Section 14.7.
Increment and Decrement Operators

Section 14.8.
Call Operator and Function Objects

Section 14.9.
Conversions and Class Types



Part IV:
Object-Oriented and Generic Programming

Chapter 15.
Object-Oriented Programming

Section 15.1.
OOP: An Overview

Section 15.2.
Defining Base and Derived Classes

Section 15.3.
Conversions and Inheritance

Section 15.4.
Constructors and Copy Control

Section 15.5.
Class Scope under Inheritance

Section 15.6.
Pure Virtual Functions

Section 15.7.
Containers and Inheritance

Section 15.8.
Handle Classes and Inheritance

Section 15.9.
Text Queries Revisited



Chapter 16.
Templates and Generic Programming

Section 16.1.
Template Definitions

Section 16.2.
Instantiation

Section 16.3.
Template Compilation Models

Section 16.4.
Class Template Members

Section 16.5.
A Generic Handle Class

Section 16.6.
Template Specializations

Section 16.7.
Overloading and Function Templates



Part V:
Advanced Topics

Chapter 17.
Tools for Large Programs

Section 17.1.
Exception Handling

Section 17.2.
Namespaces

Section 17.3.
Multiple and Virtual Inheritance



Chapter 18.
Specialized Tools and Techniques

Section 18.1.
Optimizing Memory Allocation

Section 18.2.
Run-Time Type Identification

Section 18.3.
Pointer to Class Member

Section 18.4.
Nested Classes

Section 18.5.
Union: A Space-Saving Class

Section 18.6.
Local Classes

Section 18.7.
Inherently Nonportable Features



Appendix A.
The Library

Section A.1.
Library Names and Headers

Section A.2.
A Brief Tour of the Algorithms

Section A.3.
The IO Library Revisited