C++ Primer Plus, Fourth Edition

Book description

The fourth edition presents the ANSI C++ standard beginning with a discussion of the essential elements of C++ programming: loops, expressions, functions, and classes. It walks readers through the basics of object-oriented programming: classes, inheritance, templates, and exceptions, as well as the latest object-oriented programming techniques. C++ Primer Plus contains hundreds of sample programs. The friendly tone, concise programs, and end-of-chapter review exercises allow beginners to write their own programs immediately.

Table of contents

  1. Copyright
  2. PREFACE
  3. ABOUT THE AUTHOR
  4. ACKNOWLEDGMENTS
  5. TELL US WHAT YOU THINK!
  6. GETTING STARTED
    1. Learning C++
    2. A Little History
    3. Portability and Standards
    4. The Mechanics of Creating a Program
    5. Conventions Used in This Book
    6. Our System
  7. SETTING OUT TO C++
    1. C++ Initiation
    2. More About C++ Statements
    3. More C++ Statements
    4. Functions
    5. Summary
    6. Review Questions
    7. Programming Exercises
  8. DEALING WITH DATA
    1. Simple Variables
    2. The const Qualifier
    3. Floating-Point Numbers
    4. C++ Arithmetic Operators
    5. Summary
    6. Review Questions
    7. Programming Exercises
  9. COMPOUND TYPES
    1. Introducing Arrays
    2. Strings
    3. Introducing Structures
    4. Unions
    5. Enumerations
    6. Pointers and the Free Store
    7. Pointers, Arrays, and Pointer Arithmetic
    8. Summary
    9. Review Questions
    10. Programming Exercises
  10. LOOPS AND RELATIONAL EXPRESSIONS
    1. Introducing the for Loop
    2. Relational Expressions
    3. The while Loop
    4. The do while Loop
    5. Loops and Text Input
    6. Nested Loops and Two-Dimensional Arrays
    7. Summary
    8. Review Questions
    9. Programming Exercises
  11. BRANCHING STATEMENTS AND LOGICAL OPERATORS
    1. The if Statement
    2. Logical Expressions
    3. The cctype Library of Character Functions
    4. The ?: Operator
    5. The switch Statement
    6. The break and continue Statements
    7. Number-Reading Loops
    8. Summary
    9. Review Questions
    10. Programming Exercises
  12. FUNCTIONS—C++'S PROGRAMMING MODULES
    1. Function Review
    2. Function Arguments and Passing by Value
    3. Functions and Arrays
    4. Functions and Two-Dimensional Arrays
    5. Functions and C-Style Strings
    6. Functions and Structures
    7. Recursion
    8. Pointers to Functions
    9. Summary
    10. Review Questions
    11. Programming Exercises
  13. ADVENTURES IN FUNCTIONS
    1. Inline Functions
    2. Reference Variables
    3. Default Arguments
    4. Function Polymorphism (Function Overloading)
    5. Function Templates
    6. Summary
    7. Review Questions
    8. Programming Exercises
  14. MEMORY MODELS AND NAMESPACES
    1. Separate Compilation
    2. Storage Duration, Scope, and Linkage
    3. Namespaces
    4. Summary
    5. Review Questions
    6. Programming Exercises
  15. OBJECTS AND CLASSES
    1. Procedural and Object-Oriented Programming
    2. Abstraction and Classes
    3. Class Constructors and Destructors
    4. Knowing Your Objects: The this Pointer
    5. An Array of Objects
    6. Class Scope
    7. An Abstract Data Type
    8. Summary
    9. Review Questions
    10. Programming Exercises
  16. WORKING WITH CLASSES
    1. Operator Overloading
    2. Time on Our Hands
    3. Introducing Friends
    4. Overloaded Operators: Member Versus Nonmember Functions
    5. More Overloading: A Vector Class
    6. Automatic Conversions and Type Casts for Classes
    7. Summary
    8. Review Questions
    9. Programming Exercises
  17. CLASSES AND DYNAMIC MEMORY ALLOCATION
    1. Dynamic Memory and Classes
    2. A Queue Simulation
    3. Summary
    4. Review Questions
    5. Programming Exercises
  18. CLASS INHERITANCE
    1. Beginning with a Simple Base Class
    2. Special Relationships
    3. Inheritance—An Is-a Relationship
    4. Polymorphic Public Inheritance
    5. Access Control-protected
    6. Abstract Base Classes
    7. Inheritance and Dynamic Memory Allocation
    8. Class Design Review
    9. Summary
    10. Review Questions
    11. Programming Exercises
  19. REUSING CODE IN C++
    1. Classes with Object Members
    2. Private Inheritance
    3. Multiple Inheritance
    4. Class Templates
    5. Summary
    6. Review Questions
    7. Programming Exercises
  20. FRIENDS, EXCEPTIONS, AND MORE
    1. Friends
    2. Nested Classes
    3. Exceptions
    4. RTTI
    5. Type Cast Operators
    6. Summary
    7. Review Questions
    8. Programming Exercises
  21. THE string CLASS AND THE STANDARD TEMPLATE LIBRARY
    1. The string Class
    2. The auto_ptr Class
    3. The Standard Template Library
    4. Generic Programming
    5. Function Objects (aka Functors)
    6. Algorithms
    7. Other Libraries
    8. Summary
    9. Review Questions
    10. Programming Exercises
  22. INPUT, OUTPUT, AND FILES
    1. An Overview of C++ Input and Output
    2. Output with cout
    3. Input with cin
    4. File Input and Output
    5. Incore Formatting
    6. What Now?
    7. Summary
    8. Review Questions
    9. Programming Exercises
  23. NUMBER BASES
    1. Octal Integers
    2. Hexadecimal Numbers
    3. Binary Numbers
    4. Binary and Hex
  24. C++ KEYWORDS
  25. THE ASCII CHARACTER SET
  26. OPERATOR PRECEDENCE
  27. OTHER OPERATORS
    1. Bitwise Operators
    2. Member Dereferencing Operators
  28. THE string TEMPLATE CLASS
    1. Thirteen Types and a Constant
    2. Data Information, Constructors, and So On
    3. String Access
    4. Basic Assignment
    5. String Searching
    6. Comparison Methods and Functions
    7. String Modifiers
    8. Output and Input
  29. THE STL METHODS AND FUNCTIONS
    1. Members Common to All Containers
    2. Additional Members for Vectors, Lists, and Deques
    3. Additional Members for Sets and Maps
    4. STL Functions
  30. SELECTED READINGS
  31. CONVERTING TO ANSI/ISO STANDARD C++
    1. Preprocessor Directives
    2. Use Function Prototypes
    3. Type Casts
    4. Become Familiar with C++ Features
    5. Use the New Header Organization
    6. Use Namespaces
    7. Use the autoptr Template
    8. Use the string Class
    9. Use the STL
  32. ANSWERS TO REVIEW QUESTIONS
    1. Chapter 2
    2. Chapter 3
    3. Chapter 4
    4. Chapter 5
    5. Chapter 6
    6. Chapter 7
    7. Chapter 8
    8. Chapter 9
    9. Chapter 10
    10. Chapter 11
    11. Chapter 12
    12. Chapter 13
    13. Chapter 14
    14. Chapter 15
    15. Chapter 16
    16. Chapter 17
  33. Index

Product information

  • Title: C++ Primer Plus, Fourth Edition
  • Author(s): Stephen Prata
  • Release date: November 2001
  • Publisher(s): Sams
  • ISBN: 9780672322235