C++ Programming Style ToC

Preface

0 Introduction
Bibliographic Notes

1 Abstraction
Style Example: Pricing Computers
Finding a Common Abstraction
Differences Between Classes
Reintroducing Inheritance
Removing the Enumerations
Summary
Bibliographic Notes
Exercise

2 Consistency
Style Example: Class string
Well-defined State
Consistent Physical State
Class Invariants
Consistent Use of Dynamic Memory
Deallocating Dynamic Memory
Style Example: A Second Approach 
Summary
Bibliographic Notes
Exercises

3 Unnecessary Inheritance
Style Example: Stacks
Inheritance Scope Rules
Inheritance Relationships
Encapsulation
Interface versus Implementation
Templates
Summary
Bibliographic Notes
Exercise

4 Virtual Functions
Style Example: Vehicles and Garages
Consistency
Base Destructors
Inheritance
Coupling
Summary
Bibliographic Notes
Exercise

5 Operator Overloading
Operator Overloading Basics
Style Example: Class FileArray
Inheritance for Implementation
A Programming Tradeoff: Overloaded
Operators versus Member Functions
Summary
Bibliographic Notes
Exercises

6 Wrappers
A C Library
Style Example: A C++ Wrapper for dirent
Multiple Directory Objects
Constructor Failure
Public Access to Failure State
Error Condition Argument
Summary
Bibliographic Notes
Exercise

7 Efficiency
Style Example: Class BigInt
Exercising BigInt
The Length of Dynamic Strings
The Number of Dynamic Strings
The Client Code
Rewriting BigInt
Summary
Bibliographic Notes
Exercises

8 A Case Study
Style Example: Finite State Machines
Initialization
Coupling
Cohesion
Modules versus Abstract Data Types
Generalization
Bibliographic Notes
Exercises

9 Multiple Inheritance
Ambiguities under Multiple Inheritance
Directed Acyclic Inheritance Graphs
Exploring Virtual Base Classes
Style Example: Class Monitor
Style Example: A Virtual Base Class
Multiple Protocol Inheritance
Summary
Bibliographic Notes
Exercises

10 Summary of Rules

Index

top