You are previewing C++: A Dialog Programming with the C++ Standard Library.
O'Reilly logo
C++: A Dialog Programming with the C++ Standard Library

Book Description

Simply the best way for beginners to learn standard C++.

C++: A Dialog is the easiest, most effective way for beginners to learn C++ programming.

Steve Heller teaches C++ from scratch, through a one-on-one conversation with an intelligent beginner who asks the questions you'd ask. Heller's unique dialog format is brilliantly designed to clarify the concepts you might otherwise find confusing, so you can quickly learn today's most powerful and valuable C++ development techniques.

Heller takes you from the absolute fundamentals through the construction of a complete inventory application, including a simple but effective user interface. Along the way, you won't just learn C++ features: you'll see exactly how professional programmers bring them together and put them to work.

Unlike many beginners' books, C++: A Dialog uses industry-standard C++ and the latest standard libraries—giving you skills you can use with any standard C++ toolset, in any programming environment. You even get all the example code and a standard C++ compiler on CD-ROM so you can write and compile your own standard C++ programs on any 32-bit Microsoft Windows platform.

CD-ROM INCLUDED

The accompanying CD-ROM contains the commercial-grade Borland C++ 5.5 compiler and its associated libraries, which supports the latest ANSI/ISO C++ standards, including the STL (Standard Template Library) framework and C++ templates.

Table of Contents

  1. Copyright
  2. List of Figures
  3. Foreword
  4. Preface
  5. Acknowledgments
  6. Letter from a Novice
  7. Introduction to Programming
    1. Definitions
    2. Baby Steps
  8. Hardware Fundamentals
    1. Definitions
    2. Objectives of This Chapter
    3. Inside the Box
    4. The Binary Number System
    5. Exercises
    6. Using the 16-bit Register Names
    7. Review
    8. Conclusion
    9. Answers to Exercises
  9. Basics of Programming
    1. Definitions
    2. Objectives of This Chapter
    3. Rapid and Accurate Calculation
    4. The Compiler
    5. How the CPU Stores and Manipulates Data in Memory
    6. The Layout of Data in Memory
    7. Exercises, First Set
    8. The char and string Types
    9. using, namespace, and std
    10. int main()
    11. Exercises, Second Set
    12. Input and Output
    13. Changing the Course of Execution
    14. The while Loop
    15. Exercises, Third Set
    16. Our First Slightly Realistic Program
    17. Exercises, Fourth Set
    18. Review
    19. Conclusion
    20. Answers to Exercises
  10. More Basics
    1. Objectives of This Chapter
    2. Algorithmic Thinking
    3. Handling Any Number of Prizes
    4. Index Variables
    5. The Selection Sort
    6. Program Failure
    7. Review
    8. Exercises
    9. Conclusion
    10. Answers to Exercises
  11. Functional Literacy
    1. Definitions
    2. Objectives of This Chapter
    3. Modules vs. Functions
    4. Using a Function
    5. Software Is a Virtual Computer
    6. Scope of Variables
    7. The Disadvantages of Global Variables
    8. More on Using the Stack
    9. Review
    10. Exercises
    11. Conclusion
    12. Answers to Exercises
  12. Taking Inventory
    1. Definitions
    2. Objectives of This Chapter
    3. User-defined Data Types
    4. The StockItem class
    5. More Definitions
    6. Concrete Data Types
    7. The class Scope
    8. More about the StockItem class Interface
    9. Working around the Standard Library
    10. Reference Arguments
    11. Checking Inventory for a Misplaced Item
    12. Review
    13. Exercises
    14. Conclusion
    15. Answers to Exercises
  13. Creating a Homegrown string class
    1. Objectives of This Chapter
    2. C String Literals vs. strings
    3. Dynamic Memory Allocation via new and delete
    4. Constructing a string from a C String
    5. Assignment Operator Issues
    6. Solving the Assignment Operator Problem
    7. The const Modifier for Reference Arguments
    8. Calling operator=
    9. Review
    10. Exercises
    11. Conclusion
    12. Answers to Exercises
  14. Finishing Our homegrown string class
    1. Objectives of This Chapter
    2. The string Copy Constructor
    3. More about the private Access Specifier
    4. First Review
    5. Adding Further Facilities to our string class
    6. Initialization vs. Assignment
    7. Second Review
    8. Exercises
    9. Conclusion
    10. Answers to Exercises
  15. Inheritance
    1. Definitions
    2. Objectives of This Chapter
    3. Taking Inventory
    4. Adding ReorderItems to the Inventory class
    5. Adding Expiration Dates
    6. The protected Access Specifier
    7. static Member Functions
    8. The stream classes
    9. More about stringstream
    10. Review
    11. Exercises
    12. Conclusion
  16. Polymorphism
    1. Definitions
    2. Objectives of This Chapter
    3. Introduction to Polymorphism
    4. Exercises, First Set
    5. Polymorphic Objects
    6. More Definitions
    7. Why We Need Polymorphic Objects
    8. Implementing Safe Polymorphism
    9. Reimplementing the Standard Member Functions for the New Version of StockItem
    10. Avoiding an Infinite Regress During Construction
    11. Reference Counting
    12. Sharing a Worker Object
    13. Why We Need m_Count in StockItem
    14. Review
    15. Exercises, Second Set
    16. Conclusion
  17. The Home Inventory Project
    1. Definitions
    2. Objectives of This Chapter
    3. Data Items for the Home Inventory Project
    4. The Manager/Worker Idiom Again
    5. Hiding Unnecessary Information from the class User
    6. Saving the Number of the Elements in the File
    7. Creating a Data File Programmatically
    8. Adding the Ability to Edit a Record
    9. The New Member Functions of HomeItemMusic
    10. Review
    11. Exercises
    12. Conclusion
  18. More on the Home Inventory Project
    1. Definitions
    2. Objectives of This Chapter
    3. Extending the Functionality of strings
    4. How to Implement Our New string Functionality
    5. The Include Guard
    6. Lessons of the xstring class Implementation
    7. Case-Insensitive Searching
    8. Searching for an Item by a Substring
    9. Putting It All Together
    10. How Software Development Really Works
    11. Review
    12. Conclusion
  19. Analyzing the Home Inventory Project
    1. Definitions
    2. Objectives of This Chapter
    3. The Final Version of the Home Inventory Program
    4. Using a namespace to Group Utility Functions
    5. The Functions of the HomeUtility namespace
    6. Checking the Inventory
    7. Finishing up the HomeItem class
    8. Are We Having Fun Yet?
    9. Review
    10. Exercises
    11. Conclusion
  20. Tying up Loose Ends
    1. Operator Precedence
    2. Another Native Data Type
    3. Wrapping Up
  21. Glossary
    1. Special Characters
    2. A
    3. B
    4. C
    5. D
    6. E
    7. F
    8. G
    9. H
    10. I
    11. K
    12. L
    13. M
    14. N
    15. O
    16. P
    17. R
    18. S
    19. T
    20. U
    21. V
    22. W
    23. Y
    24. Z
  22. About the Author
  23. Bibliography
  24. About the CD-ROM
    1. Technical Support:
    2. License Agreement and Limited Warranty
    3. Acknowledgment
  25. Index