| |
| |
Preface | |
| |
| |
| |
Basic Philosophical Differences | |
| |
| |
| |
The Language C | |
| |
| |
| |
The Development of C++ | |
| |
| |
| |
The Legacy Problem | |
| |
| |
| |
The Language Java | |
| |
| |
| |
The Better Language | |
| |
| |
| |
Further Reading | |
| |
| |
Test Your Understanding | |
| |
| |
| |
Fundamental Data Types | |
| |
| |
| |
Integers | |
| |
| |
| |
Characters | |
| |
| |
| |
Booleans | |
| |
| |
| |
Bit Fields | |
| |
| |
| |
Floating Point Values | |
| |
| |
| |
Enumerated Values | |
| |
| |
| |
The void Type | |
| |
| |
| |
Arrays | |
| |
| |
| |
Structures and Unions | |
| |
| |
| |
Object Values | |
| |
| |
| |
Functions | |
| |
| |
| |
Order of Argument Evaluation | |
| |
| |
| |
The Function main | |
| |
| |
| |
Alternative main Entry Points | |
| |
| |
Test Your Understanding | |
| |
| |
| |
Pointers and References | |
| |
| |
| |
Java Pointers | |
| |
| |
| |
Pointers on Pointers | |
| |
| |
| |
The address-of Operator | |
| |
| |
| |
Pointers to Simple Values | |
| |
| |
| |
Pointers to Pointer | |
| |
| |
| |
Pointers and const | |
| |
| |
| |
void* Pointers | |
| |
| |
| |
Pointers to Functions | |
| |
| |
| |
Pointers to Structures | |
| |
| |
| |
Pointers to Arrays | |
| |
| |
| |
References | |
| |
| |
| |
Pass by Reference Parameters | |
| |
| |
| |
References as Results | |
| |
| |
Test Your Understanding | |
| |
| |
| |
Memory Management | |
| |
| |
| |
The Memory Model | |
| |
| |
| |
Stack-Resident Memory Values | |
| |
| |
| |
Lifetime Errors | |
| |
| |
| |
Size Errors | |
| |
| |
| |
Heap-Resident Memory Values | |
| |
| |
| |
Encapsulating Memory Management | |
| |
| |
| |
Reference Counts | |
| |
| |
Test Your Understanding | |
| |
| |
| |
Class Definition | |
| |
| |
| |
Obvious Similarities and Minor Differences | |
| |
| |
| |
Separation of Class and Implementation | |
| |
| |
| |
Interface and Implementation Files | |
| |
| |
| |
The inline Directive | |
| |
| |
| |
Prototypes | |
| |
| |
| |
External Declarations | |
| |
| |
| |
Forward References | |
| |
| |
| |
Constructors and Initialization | |
| |
| |
| |
Default and Copy Constructors | |
| |
| |
| |
Initializers | |
| |
| |
| |
Order of Initialization | |
| |
| |
| |
Combining Constructors | |
| |
| |
| |
The Orthodox Canonical Class Form | |
| |
| |
| |
Visibility Modifiers | |
| |
| |
| |
Inner Classes Versus Nested Classes | |
| |
| |
| |
Static Initialization | |
| |
| |
| |
Final Classes | |
| |
| |
Test Your Understanding | |
| |
| |
| |
Polymorphism | |
| |
| |
| |
Virtual and Nonvirtual Overriding | |
| |
| |
| |
Impact of Virtual on Size | |
| |
| |
| |
Obtaining Type Information from a Dynamic Value | |
| |
| |
| |
Abstract Classes | |
| |
| |
| |
Downcasting (Reverse Polymorphism) | |
| |
| |
| |
Simulating the Dynamic Cast | |
| |
| |
| |
Name Resolution | |
| |
| |
| |
A Forest, Not a Tree | |
| |
| |
| |
Virtual Destructors | |
| |
| |
| |
Private Inheritance | |
| |
| |
| |
Inheritance and Arrays | |
| |
| |
| |
Overloading | |
| |
| |
Test Your Understanding | |
| |
| |
| |
Operator Overloading | |
| |
| |
| |
Overloaded Functions or Methods | |
| |
| |
| |
The Simple Binary Operators | |
| |
| |
| |
The Comparison Operators | |
| |
| |
| |
The Increment and Decrement Operators | |
| |
| |
| |
The Shift Operators | |
| |
| |
| |
The Assignment Operator | |
| |
| |
| |
The Compound Assignment Operators | |
| |
| |
| |
The Subscript Operator | |
| |
| |
| |
The Parenthesis Operator | |
| |
| |
| |
The Address-of Operator | |
| |
| |
| |
The Logical Connectives | |
| |
| |
| |
The Comma Operator | |
| |
| |
| |
The Arrow Operator | |
| |
| |
| |
Pointers to Members and Pointers to Member Functions | |
| |
| |
| |
Conversion Operators | |
| |
| |
| |
Memory Management Operators | |
| |
| |
| |
Disallowing Operations | |
| |
| |
| |
Implicit Functions and Invocations | |
| |
| |
| |
Implicitly Created Operations | |
| |
| |
| |
Implicit Function Invocations | |
| |
| |
Test Your Understanding | |
| |
| |
| |
Characters and Strings | |
| |
| |
| |
Characters and Literals Strings | |
| |
| |
| |
Character Literals and the cctype Library | |
| |
| |
| |
String Literals | |
| |
| |
| |
The cstring Library | |
| |
| |
| |
Constant and Mutable Values | |
| |
| |
| |
The string Data Type | |
| |
| |
| |
Example Program--Split a Line into Words | |
| |
| |
Test Your Understanding | |
| |
| |
| |
Templates and Containers | |
| |
| |
| |
Template Classes | |
| |
| |
| |
Template Methods | |
| |
| |
| |
Template Functions | |
| |
| |
| |
The Standard Template Library | |
| |
| |
| |
Containers | |
| |
| |
| |
Iterators | |
| |
| |
| |
Generic Algorithms | |
| |
| |
| |
Function Objects | |
| |
| |
Test Your Understanding | |
| |
| |
| |
Input/Output | |
| |
| |
| |
The stdio Library | |
| |
| |
| |
Formatted Output | |
| |
| |
| |
The Stream I/O Facility | |
| |
| |
| |
Stream Input | |
| |
| |
| |
String Streams | |
| |
| |
| |
File Streams | |
| |
| |
| |
An Example Program | |
| |
| |
Test Your Understanding | |
| |
| |
| |
Exception Handling | |
| |
| |
| |
Flags and Return Codes | |
| |
| |
| |
The Assertion Library | |
| |
| |
| |
The setjmp and longjmp Facility | |
| |
| |
| |
Signals | |
| |
| |
| |
Exception Handling | |
| |
| |
| |
Exception Types | |
| |
| |
| |
Rethrowing Exceptions | |
| |
| |
| |
No Finally Clause | |
| |
| |
| |
References as Exceptions | |
| |
| |
| |
Exception Class Clonability | |
| |
| |
| |
No Need to Document Exceptions | |
| |
| |
| |
Standard Exceptions | |
| |
| |
Test Your Understanding | |
| |
| |
| |
Features Found Only in C++ | |
| |
| |
| |
Global Variables | |
| |
| |
| |
The Preprocessor | |
| |
| |
| |
typedef Statement | |
| |
| |
| |
The const Keyword | |
| |
| |
| |
Default Arguments | |
| |
| |
| |
Friends | |
| |
| |
| |
Name Spaces | |
| |
| |
| |
Multiple Inheritance | |
| |
| |
| |
goto Statement | |
| |
| |
Test Your Understanding | |
| |
| |
| |
Features Found Only in Java | |
| |
| |
| |
Wrapper Classes | |
| |
| |
| |
Interfaces | |
| |
| |
| |
Inline Classes | |
| |
| |
| |
Threads | |
| |
| |
| |
Reflection | |
| |
| |
Test Your Understanding | |
| |
| |
| |
Case Study--Fractions | |
| |
| |
| |
Classes | |
| |
| |
| |
Interface and Implementation | |
| |
| |
| |
Constructors | |
| |
| |
| |
Behavior | |
| |
| |
| |
Member Functions | |
| |
| |
| |
Operators | |
| |
| |
| |
Increment and Decrement | |
| |
| |
| |
Functions | |
| |
| |
| |
Member Function Operators | |
| |
| |
| |
Conversion Operations | |
| |
| |
| |
Input and Output Streams | |
| |
| |
| |
Stream Input | |
| |
| |
Test Your Understanding | |
| |
| |
| |
Case Study--Containers | |
| |
| |
| |
Shortest Path Graph Problem | |
| |
| |
| |
Shortest Path Algorithm | |
| |
| |
| |
Developing the Data Structures | |
| |
| |
| |
A Concordance | |
| |
| |
Test Your Understanding | |
| |
| |
| |
Case Study--A Card Game | |
| |
| |
| |
The Class Card | |
| |
| |
| |
Data and View Classes | |
| |
| |
| |
The Game | |
| |
| |
| |
Card Piles--Inheritance in Action | |
| |
| |
| |
The Default Card Pile | |
| |
| |
| |
The Suit Piles | |
| |
| |
| |
The Deck Pile | |
| |
| |
| |
The Discard Pile | |
| |
| |
| |
The Table Piles | |
| |
| |
| |
Playing the Polymorphic Game | |
| |
| |
| |
The Graphical User Interface | |
| |
| |
Test Your Understanding | |
| |
| |
| |
Case Study--Combining Separate Classes | |
| |
| |
Test Your Understanding | |
| |
| |
| |
Include Files | |
| |
| |
| |
Input and Output | |
| |
| |
| |
Diagnostics | |
| |
| |
| |
Strings | |
| |
| |
| |
STL Containers | |
| |
| |
| |
STL Utility Routines | |
| |
| |
| |
Numeric Support | |
| |
| |
| |
Run-Time Support | |
| |
| |
| |
Miscellaneous | |
| |
| |
References | |
| |
| |
Index | |