| |
| |
Preface | |
| |
| |
| |
Object-Oriented Programming with Classes | |
| |
| |
Object-Oriented ProgrammingClasses | |
| |
| |
| |
C++ Without ClassesThree to Start | |
| |
| |
Function Changes | |
| |
| |
Stricter Typing | |
| |
| |
Dynamic Initialization of Globals | |
| |
| |
Some Final Lists | |
| |
| |
| |
Abstraction with Member Functions | |
| |
| |
The Abstraction | |
| |
| |
Using a struct | |
| |
| |
Using a struct with Interface Functions | |
| |
| |
Using a Class with Member Functions | |
| |
| |
| |
Encapsulation with Access Specifiers | |
| |
| |
Access Specifiers | |
| |
| |
A Member Can Have Any Access Level | |
| |
| |
Unlimited Access Specifiers | |
| |
| |
Private Does Not Mean Invisibl | |
| |
| |
eFriend Classes | |
| |
| |
| |
Hierarchy with Composition and Derivation | |
| |
| |
Composition | |
| |
| |
Derivation | |
| |
| |
Chaining | |
| |
| |
| |
Better Abstraction with Constructors and Destructors | |
| |
| |
The Default Constructor | |
| |
| |
The Destructor | |
| |
| |
Built-in Types | |
| |
| |
Hierarchy and Chaining | |
| |
| |
Implicit Default Constructors and Destructors | |
| |
| |
Beyond Chaining | |
| |
| |
Explicit Invocation | |
| |
| |
Flow of Control | |
| |
| |
Time of Invocation | |
| |
| |
| |
Better Abstraction with new and delete | |
| |
| |
Dynamic Objects | |
| |
| |
Dynamic Arrays | |
| |
| |
Mixing Allocators | |
| |
| |
realloc()Out of Memory | |
| |
| |
| |
References | |
| |
| |
Parameter Versus Argument | |
| |
| |
Passing by Value in C and C++ | |
| |
| |
Passing by Reference in C++ | |
| |
| |
Reference Versus Pointer | |
| |
| |
Returning by Reference in C++ | |
| |
| |
Overloading: Reference Versus Value | |
| |
| |
Binding Problems | |
| |
| |
| |
Better Abstraction with Other Special Member Functions | |
| |
| |
Assignment Operator | |
| |
| |
Copy Constructor | |
| |
| |
Printing an ObjectSummary | |
| |
| |
| |
An Example Class | |
| |
| |
Using an int | |
| |
| |
Using a Static Array | |
| |
| |
Using a Dynamic Array | |
| |
| |
Using a Reference-Counted String | |
| |
| |
Copy Constructor Quiz | |
| |
| |
Summary Table | |
| |
| |
| |
Better Hierarchy with Templates | |
| |
| |
Defining a Template | |
| |
| |
Using a Template to Define an Object | |
| |
| |
Careful with That Expansion, EugeneModifying Container Class Elements | |
| |
| |
| |
Polymorphism with Virtual Functions | |
| |
| |
Polymorphism in CVirtual Functions | |
| |
| |
Polymorphism in C++ | |
| |
| |
More About Virtual Functions | |
| |
| |
| |
More About Polymorphism | |
| |
| |
Abstract Classes | |
| |
| |
Derivation Decisions | |
| |
| |
Virtual Decisions | |
| |
| |
Calling Virtual Functions from Constructors and Destructors | |
| |
| |
Under the HoodPitfalls | |
| |
| |
| |
Implementing an Object-Oriented Design | |
| |
| |
Implementation Table | |
| |
| |
ExamplesIs-A, Has-ADefensive Implementation | |
| |
| |
| |
An Example Program | |
| |
| |
The String Class | |
| |
| |
The Rule, CwRule, and HwRule Classes | |
| |
| |
The Scanner Class | |
| |
| |
Using the ProgramExample Code | |
| |
| |
| |
What to Study Next | |
| |
| |
constinline | |
| |
| |
Constructors with Parameters | |
| |
| |
Member Initialization Lists | |
| |
| |
Efficient Copy Constructor | |
| |
| |
Special Member Functions | |
| |
| |
| |
C++ Operators | |
| |
| |
| |
One Problem with Returning by Value | |
| |
| |
Glossary | |
| |
| |
Index | |