Sams Teach Yourself C++ in 24 Hours, Third Edition

Book description

Sams Teach Yourself C++ in 24 Hours, Third Edition extends to the beginning C++ programmer the promise of a solid and thorough tutorial broken down into consistent, manageable lessons of one hour each. The readers can master the core concepts and techniques of C++ programming at their own pace. The book covers all the basics, from introducing C++ syntax to developing C++ classes to introductory OOP concepts in a non-threatening, positive approach.

Table of contents

  1. Copyright
  2. About the Author
  3. Acknowledgments
  4. Tell Us What You Think!
  5. Introduction
  6. Introducing C++
    1. Getting Started
      1. Preparing to Program
      2. C++, ANSI C++, ISO C++, Windows, and Other Areas of Confusion
      3. Installing and Setting Up the Compiler
      4. Compiling and Linking the Source Code
      5. The Development Cycle
      6. HELLO.CPP—Your First C++ Program
      7. Compile Errors
      8. Summary
      9. Q&A
    2. The Parts of a C++ Program
      1. Why C++ Is the Right Choice
      2. The Parts of a Simple Program
      3. Comments
      4. Functions
      5. Summary
      6. Q & A
    3. Variables and Constants
      1. What Is a Variable?
      2. Defining a Variable
      3. Creating More Than One Variable at a Time
      4. Assigning Values to Your Variables
      5. typedef
      6. When to Use short and When to Use long
      7. Constants
      8. Enumerated Constants
      9. Summary
      10. Q&A
    4. Expressions and Statements
      1. Statements
      2. Expressions
      3. Operators
      4. Combining the Assignment and Mathematical Operators
      5. Increment and Decrement
      6. Precedence
      7. Nesting Parentheses
      8. The Nature of Truth
      9. Relational Operators
      10. The if Statement
      11. Use Braces in Nested if Statements
      12. Logical Operators
      13. Relational Precedence
      14. More About Truth and Falsehood
      15. Summary
      16. Q&A
    5. Functions
      1. What Is a Function?
      2. Declaring and Defining Functions
      3. Local Variables
      4. Global Variables
      5. Function Statements
      6. Function Arguments
      7. Parameters Are Local Variables
      8. Return Values
      9. Default Parameters
      10. Overloading Functions
      11. Summary
      12. Q&A
    6. Program Flow
      1. Looping
      2. while Loops
      3. do...while Loops
      4. for Loops
      5. switch Statements
      6. Summary
      7. Q&A
  7. Classes
    1. Basic Classes
      1. What Is a Type?
      2. Creating New Types
      3. Classes and Members
      4. Accessing Class Members
      5. Private Versus Public
      6. Implementing Class Methods
      7. Constructors and Destructors
      8. Summary
      9. Q&A
    2. More About Classes
      1. const Member Functions
      2. Interface Versus Implementation
      3. Where to Put Class Declarations and Method Definitions
      4. Inline Implementation
      5. Classes with Other Classes as Member Data
      6. Summary
      7. Q&A
  8. Memory Management
    1. Pointers
      1. What Is a Pointer?
      2. Why Would You Use Pointers?
      3. The Stack and the Heap
      4. Summary
      5. Q&A
    2. Advanced Pointers
      1. Creating Objects on the Heap
      2. Deleting Objects
      3. Accessing Data Members Using Pointers
      4. Member Data on the Heap
      5. The this Pointer
      6. What's the this Pointer For?
      7. Stray or Dangling Pointers
      8. const Pointers
      9. Summary
      10. Q&A
    3. References
      1. What Is a Reference?
      2. Creating a Reference
      3. Using the Address of Operator on References
      4. What Can Be Referenced?
      5. Null Pointers and Null References
      6. Passing Function Arguments by Reference
      7. Understanding Function Headers and Prototypes
      8. Returning Multiple Values
      9. Summary
      10. Q&A
    4. Advanced References and Pointers
      1. Passing by Reference for Efficiency
      2. References as an Alternative to Pointers
      3. When to Use References and When to Use Pointers
      4. Don't Return a Reference to an Object That Isn't in Scope!
      5. Returning a Reference to an Object on the Heap
      6. Pointer, Pointer, Who Has the Pointer?
      7. Summary
      8. Q&A
  9. Power Tools
    1. Advanced Functions
      1. Overloaded Member Functions
      2. Using Default Values
      3. Choosing Between Default Values and Overloaded Functions
      4. Overloading Constructors
      5. Initializing Objects
      6. The Copy Constructor
      7. Summary
      8. Q&A
    2. Operator Overloading
      1. Operator Overloading
      2. Conversion Operators
      3. Summary
      4. Q&A
    3. Arrays
      1. What Is an Array?
      2. Array Elements
      3. Writing Past the End of an Array
      4. Fence Post Errors
      5. Initializing Arrays
      6. Arrays of Objects
      7. Multidimensional Arrays
      8. A Word About Memory
      9. Arrays of Pointers
      10. Declaring Arrays on the Heap
      11. A Pointer to an Array Versus an Array of Pointers
      12. Pointers and Array Names
      13. Deleting Arrays on the Heap
      14. char Arrays
      15. strcpy() and strncpy()
      16. String Classes
      17. Summary
      18. Q&A
  10. Inheritance and Polymorphism
    1. Inheritance
      1. What Is Inheritance?
      2. Private Versus Protected
      3. Constructors and Destructors
      4. Overriding Functions
      5. Summary
      6. Q&A
    2. Polymorphism and Derived Classes
      1. Polymorphism Implemented With Virtual Methods
      2. Summary
      3. Q&A
    3. Advanced Polymorphism
      1. Problems with Single Inheritance
      2. Abstract Data Types
      3. Summary
      4. Q&A
    4. Linked Lists
      1. Linked Lists and Other Structures
      2. A Case Study
      3. The Component Parts
      4. What Have You Learned, Dorothy?
      5. Summary
      6. Q&A
  11. Special Topics
    1. Special Classes, Functions, and Pointers
      1. Static Member Data
      2. Static Member Functions
      3. Containment
      4. Friend Classes
      5. Friend Functions
      6. Pointers to Functions
      7. Pointers to Member Functions
      8. Summary
      9. Q&A
    2. The Preprocessor
      1. The Preprocessor and the Compiler
      2. Seeing the Intermediate Form
      3. Using #define
      4. Inclusion and Inclusion Guards
      5. Macro Functions
      6. String Manipulation
      7. Predefined Macros
      8. Summary
      9. Q&A
    3. Object-Oriented Analysis and Design
      1. The Development Cycle
      2. Simulating an Alarm System
      3. PostMaster: A Case Study
      4. Summary
      5. Q&A
    4. Templates
      1. What Are Templates?
      2. Parameterized Types
      3. Template Definition
      4. Using Template Items
      5. The Standard Template Library
      6. Summary
      7. Q&A
    5. Exceptions and Error Handling
      1. Bugs, Errors, Mistakes, and Code Rot
      2. Exceptions
      3. Using try Blocks and catch Blocks
      4. Next Steps
      5. Style
      6. Next Steps
  12. Appendices
    1. Binary and Hexadecimal
      1. Other Bases
      2. Around the Bases
      3. Hexadecimal
    2. Glossary
  13. Index

Product information

  • Title: Sams Teach Yourself C++ in 24 Hours, Third Edition
  • Author(s): Jesse Liberty
  • Release date: August 2001
  • Publisher(s): Sams
  • ISBN: 9780672322242