Description
Book SynopsisA first book for C programmers transitioning to C++, an object-oriented enhancement of the C programming language. Designed to get readers up to speed quickly, this book thoroughly explains the important concepts and features and gives brief overviews of the rest of the language. It covers features common to all C++ compilers, including those on UNIX, WIndows, NT, DOS and Macs.
Table of ContentsPreface Chapter 1. Object-Oriented Programming with Classes Object-Oriented Programming Classes Chapter 2. C++ Without Classes Three to Start Function Changes Stricter Typing Dynamic Initialization of Globals Some Final Lists Chapter 3. Abstraction with Member Functions The Abstraction Using a struct Using a struct with Interface Functions Using a Class with Member Functions Chapter 4. Encapsulation with Access Specifiers Access Specifiers A Member Can Have Any Access Level Unlimited Access Specifiers Private Does Not Mean Invisible Friend Classes Chapter 5. Hierarchy with Composition and Derivation Composition Derivation Chaining Chapter 6. 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 Chapter 7. Better Abstraction with new and delete Dynamic Objects Dynamic Arrays Mixing Allocators realloc() Out of Memory Chapter 8. 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 Chapter 9. Better Abstraction with Other Special Member Functions Assignment Operator Copy Constructor Printing an Object Summary Chapter 10. An Example Class Using an int Using a Static Array Using a Dynamic Array Using a Reference-Counted String Copy Constructor Quiz Summary Table Chapter 11. Better Hierarchy with Templates Defining a Template Using a Template to Define an Object Careful with That Expansion, Eugene Modifying Container Class Elements Chapter 12. Polymorphism with Virtual Functions Polymorphism in C Virtual Functions Polymorphism in C++ More About Virtual Functions Chapter 13. More About Polymorphism Abstract Classes Derivation Decisions Virtual Decisions Calling Virtual Functions from Constructors and Destructors Under the Hood Pitfalls Chapter 14. Implementing an Object-Oriented Design Implementation Table Examples Is-A, Has-A Defensive Implementation Chapter 15. An Example Program The String Class The Rule, CwRule, and HwRule Classes The Scanner Class Using the Program Example Code Chapter 16. What to Study Next const inline Constructors with Parameters Member Initialization Lists Efficient Copy Constructor Special Member Functions Appendix A. C++ Operators Appendix B. One Problem with Returning by Value Glossary Index