Home > Store

Sams Teach Yourself C++ in 24 Hours, Complete Starter Kit, 3rd Edition

Register your product to gain access to bonus material or receive a coupon.

Sams Teach Yourself C++ in 24 Hours, Complete Starter Kit, 3rd Edition

Premium Website

  • Sorry, this book is no longer in print.
Not for Sale


  • Copyright 2002
  • Edition: 3rd
  • Premium Website
  • ISBN-10: 0-672-32224-2
  • ISBN-13: 978-0-672-32224-2

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.

Sample Content

Online Sample Chapter

Variables and Constants in C++

Table of Contents

(NOTE: Hour 1 to Hour 25 conclude with a Summary and a Question and Answer section).



Hour 1—Getting Started.

Preparing to Program. C++, ANSI C++, ISO C++, Windows, and Other. Areas of Confusion. Installing and Setting Up the Compiler. Compiling and Linking the Source Code. The Development Cycle. HELLO.CPP—Your First C++ Program. Compile Errors.

Why C++ Is the Right Choice. The Parts of a Simple Program. Comments. Functions.

Hour 3—Variables and Constants.

What Is a Variable? Defining a Variable. Creating More Than One Variable at a Time. Assigning Values to Your Variables. Typedef. When to Use short and When to Use long. Constants. Enumerated Constants.

Hour 4—Expressions and Statements.

Statements. Expressions. Operators. Combining the Assignment and Mathematical Operators. Increment and Decrement. Precedence. Nesting Parentheses. The Nature of Truth. Relational Operators. The if Statement. Use Braces in Nested if Statements. Logical Operators. Relational Precedence. More About Truth and Falsehood.

Hour 5—Functions.

What Is a Function? Declaring and Defining Functions. Local Variables. Global Variables. Function Statements. Function Arguments. Parameters Are Local Variables. Return Values. Default Parameters. Overloading Functions.

Hour 6—Program Flow.

Looping. while Loops. do...while Loops. for Loops. switch Statements.


Hour 7—Basic Classes.

What Is a Type? Creating New Types. Classes and Members. Accessing Class Members. Private Versus Public. Implementing Class Methods. Constructors and Destructors.

Hour 8—More About Classes.

const Member Functions. Interface Versus Implementation. Where to Put Class Declarations and Method Definitions. Inline Implementation. Classes with Other Classes as Member Data.


Hour 9<107>Pointers.

What Is a Pointer? Why Would You Use Pointers? The Stack and the Heap.

Hour 10—Advanced Pointers.

Creating Objects on the Heap. Deleting Objects. Accessing Data. Members Using Pointers. Member Data on the Heap. The this Pointer. What's the this Pointer For? Stray or Dangling Pointers. const Pointers.

Hour 11—References.

What Is a Reference? Creating a Reference. Using the Address of Operator on References. What Can Be Referenced? Null Pointers and Null References. Passing Function Arguments by Reference. Understanding Function Headers and Prototypes. Returning Multiple Values.

Hour 12—Advanced References and Pointers.

Passing by Reference for Efficiency. References as an Alternative to Pointers. When to Use References and When to Use Pointers. Don't Return a Reference to an Object That Isn't in Scope! Returning a Reference to an Object on the Heap. Pointer, Pointer, Who Has the Pointer?


Hour 13—Advanced Functions.

Overloaded Member Functions. Using Default Values. Choosing Between Default Values and Overloaded Functions. Overloading Constructors. Initializing Objects. The Copy Constructor.

Hour 14—Operator Overloading.

Operator Overloading. Conversion Operators.

Hour 15—Arrays.

What Is an Array? Array Elements. Writing Past the End of an Array. Fence Post Errors. Initializing Arrays. Arrays of Objects. Multidimensional Arrays. A Word About Memory. Arrays of Pointers. Declaring Arrays on the Heap. A Pointer to an Array Versus an Array of Pointers. Pointers and Array Names. Deleting Arrays on the Heap. char Arrays. strcpy() and strncpy(). String Classes.


Hour 16—Inheritance.

What Is Inheritance? Private Versus Protected. Constructors and Destructors. Overriding Functions.

Hour 17—Polymorphism and Derived Classes.

Polymorphism Implemented With Virtual Methods.

Hour 18—Advanced Polymorphism.

Problems with Single Inheritance. Abstract Data Types.

Hour 19—Linked Lists.

Linked Lists and Other Structures. A Case Study. The Component Parts. What Have You Learned, Dorothy?


Hour 20—Special Classes, Functions, and Pointers.

Static Member Data. Static Member Functions. Containment. Friend Classes. Friend Functions. Pointers to Functions. Pointers to Member Functions.

Hour 21—The Preprocessor.

The Preprocessor and the Compiler. Seeing the Intermediate Form. Using #define. Inclusion and Inclusion Guards. Macro Functions. String Manipulation. Predefined Macros.

Hour 22—Object-Oriented Analysis and Design.

The Development Cycle. Simulating an Alarm System. PostMaster: A Case Study.

Hour 23—Templates.

What Are Templates? Parameterized Types. Template Definition. Using Template Items. The Standard Template Library.

Hour 24—Exceptions and Error Handling.

Bugs, Errors, Mistakes, and Code Rot. Exceptions. Using try Blocks and catch Blocks. Next Steps. Style. Next Steps.


Appendix A. Binary and Hexadecimal.
Appendix B. Glossary.


Submit Errata

More Information

Unlimited one-month access with your purchase
Free Safari Membership