1 Why Object-Oriented Programming in C++?
1.1 Object-Oriented Programming
1.2 An Example C++ Program
1.3 Encapsulation and Type-Extensibility
1.4 Constructors and Destructors
1.5 Overloading
1.6 Templates and Generic Programming
1.7 The Standard Template Library (STL)
1.8 Inheritance
1.9 Polymorphism
1.10 C++ Exceptions
1.11 Benefits of Object-Oriented Programming.
2 Native Types and Statements
2.1 Program Elements
2.2 Input/Output
2.3 Program Structure
2.4 Simple Types
2.5 The Traditional Conversions
2.6 Enumeration Types
2.7 Expressions
2.8 Statements
2.9 Pragmatics
Summary
Exercises
3 Functions and Pointers
3.1 Functions
3.2 Function Definition
3.3 The return Statement
3.4 Function Prototypes
3.5 Default Arguments
3.6 Overloading Functions
3.7 Inlining
3.8 Scope and Storage Class
3.9 Namespaces
3.10 Pointer Types
3.11 The Uses of void
3.12 Arrays and Pointers
3.13 The Relationship between Arrays and Pointers
3.14 Passing Arrays to Functions
3.15 Reference Declarations and Call-by-Reference
3.16 Assertions and Program Correctness
3.17 Strings: The char* Convention
3.18 Multidimensional Arrays
3.19 Free Store Operators new and delete
3.20 Pragmatics
4 Implementing ADTs in the Base Language
4.1 The Aggregate Type struct
4.2 Structure Pointer Operator
4.3 An Example: Stack
4.4 Unions
4.5 Complex Numbers
4.6 Example: A Flush
4.7 Bit Fields
4.8 An Example: Two-Dimensional Dynamic Arrays
4.9 Pragmatics
Summary
Exercises
5 Data Hiding and Member Functions
5.1 Member Functions
5.2 Access: Private and Public
5.3 Classes
5.4 Class Scope
5.5 Example: Revisiting the Flush
5.6 static Member
5.7 The this Pointer
5.8 static and const Member Functions
5.9 Containers and Item Access
5.10 Pragmatics
Summary
Exercises
6 Object Creation and Destruction
6.1 Classes with Constructors
6.2 Constructing a Dynamically Sized Stack
6.3 Classes with Destructors
6.4 An Example: Dynamically Allocated Strings
6.5 AClass vect
6.6 Members that Are Class Types
6.7 Example: A Singly Linked List
6.8 Two-Dimensional Arrays
6.9 Polynomials as a Linked List
6.10 Strings Using Reference Semantics
6.11 No Constructor, Copy Constructor, and Other Mysteries,
6.12 Pragmatics
Summary
Exercises
7 Ad Hoc Polymorphism
7.1 ADT Conversions
7.2 Overloading and Function Selection
7.3 Friend Functions
7.4 Overloading Operators
7.5 Unary Operator Overloading
7.6 Binary Operator Overloading
7.7 Overloading Assignment and Subscripting Operators
7.8 Polynomial: Type and Language Expectations
7.9 Overloading I/O Operators <<and>>
7.10 Overloading Operator () for Indexing
7.11 Pointer Operators
7.12 Overloading new and delete
7.13 Pragmatics
Summary
Exercises
8 Visitation: lterators and Containers
8.1 Visitation
8.2 Iterators
8.3 An Example: quicksort()
8.4 Friendly Classes and Iterators
8.5 Generic Programming with roi d*
8.6 List and List Iterator
8.7 Pragmatics
Summary
Exercises
9 Templates, Generic Programming, and STL
9.1 Template Class stack
9.2 Function Templates
9.3 Class Templates
9.4 Parameterizing the Class vector
9.5 Parameterizing qui cksort()
9.6 Parameterized Binary Search Tree
9.7 STL
9.8 Containers
9.9 Iterators
9.10 Algorithms
9.11 Functions
9.12 Function Adaptors
9.13 Pragmatics
Summary
Exercises
10 Inheritance
10.1 A Derived Class
10.2 Typing Conversions and Visibility
10.3 Code Reuse: A Binary Tree Class
10.4 Virtual Functions
10.5 Abstract Base Classes
10.6 Templates and Inheritance
10.7 Multiple Inheritance
10.8 Inheritance and Design
10.9 Run-Time Type Identification
10.10 Pragmatics
Summary
Exercises
11 Exceptions
11.1 Using assert.h
11.2 Using signa.h
11.3 C++ Exceptions
11.4 Throwing Exceptions
11.5 Try Blocks
11.6 Handlers
11.7 Exception Specification
11.8 terminate() and unexpected()
11.9 Example Exception Code
11.10 Standard Exceptions and their Uses
11.11 Pragmatics
Summary
Exercises
12 OOP Using C++
12.1 OOP Language Requirements
12.2 ADTs in Non-OOP Languages
12.3 Clients and Manufacturers
12.4 Reuse and Inheritance
12.5 Polymorphism
12.6 Language Complexity
12.7 C++ OOP Bandwagon
12.8 Platonism: Tabula Rasa Design
12.9 Design Principles
12.10 Schema, Diagrams, and Tools
12.11 Design Patterns
12.12 C++: A Critique
Summary
Exercises
A ASCII Character Codes
B Operator Precedence and Associativity
C Language Guide
C.1 Program Structure
C.2 Lexical Elements
C.3 Constants
C.4 Declarations and Scope Rules
C.5 Namespaces
C.6 Linkage Rules
C.7 Types
C.8 Conversion Rules and Casts
C.9 Expressions and Operators
C.10 Statements
C.11 Functions
C.12 Classes
C.13 Inheritance
C.14 Template
C.15 Exceptions
C.16 Caution and Compatibility
C.17 New Features in C++
D Input/Output
D.1 The Output Class ostream
D.2 Formatted Output and iomanip.h
D.3 User-Defined Types: Output
D.4 The Input Class istream
D.5 Files
D.6 Using Strings as Streams
D.7 The Functions and Macros in ctype.h
D.8 Using Stream States
D.9 Mixing I/O Libraries
E STL and String Libraries
E.1 Containers
E.2 Iterators
E.3 Algorithms
E.4 Functions
E.5 Allocators
E.6 String Library
References
Index