Product Cover Image

Sams Teach Yourself C++ in One Hour a Day, CourseSmart eTextbook

By Siddhartha Rao

Published by Sams

Published Date: May 1, 2012

More Product Info

Description

Sams Teach Yourself C++ in One Hour a Day is the latest version of our long-time best-seller Sams Teach Yourself C++ in 21 Days, which has already taught more than 250,000 programmers how to use C++. This edition has been revised to reflect the latest C++ standards and compilers, and contains substantially expanded coverage of today's C++ Standard Template Library (STL). Replete with thoroughly explained code and syntax examples, it is the broadest and deepest introductory C++ tutorial available: simply the best book for readers who are serious about truly mastering C++. Improved throughout, this edition starts with a clearer, more example-rich introduction, and contains new material previewing the forthcoming C++0x standard. Coverage includes: * Understanding the anatomy of a C++ program * Core language features: variables, constants, strings, arrays, expressions, statements, operators, functions, pointers, references, and more * Fundamentals of modern object-oriented programming with C++, from classes and objects to macros and templates * STL basics: String Class, Dynamic Array Classes, Lists, Sets, Multisets, Maps, and Multimaps * Even more STL: Function Objects, Algorithms, Adaptive Containers, and Bit Flags * Advanced C++: Smart Pointers, streams, exception handling, preprocessing, and more

Table of Contents

Sams Teach Yourself C++ in One Hour a Day

Covers C++11


PART I: THE BASICS


LESSON 1: Getting Started

A Brief History of C++

Programming a C++ Application

What's New in C++11

LESSON 2: The Anatomy of a C++ Program

Part of the Hello World Program

The Concept of Namespaces

Comments in C++ Code

Functions in C++

Basic Input Using std::cin and Output Using std::cout

LESSON 3: Using Variables, Declaring Constants

What Is a Variable?

Common Compiler-Supported C++ Variable Types

Determining the Size of a Variable Using sizeof

Using typedef to Substitute a Variable's Type

What Is a Constant?

Naming Variables and Constants

Keywords You Cannot Use as Variable or Constant Names

LESSON 4: Managing Arrays and Strings

What Is an Array?

Multidimensional Arrays

Dynamic Arrays

C-style Strings

C++ Strings: Using std::string

LESSON 5: Working with Expressions, Statements, and Operators

Statements

Compound Statements or Blocks

Using Operators

LESSON 6: Controlling Program Flow

Conditional Execution Using if … else

Getting Code to Execute in Loops

Modifying Loop Behavior Using continue and break

Programming Nested Loops

LESSON 7: Organizing Code with Functions

The Need for Functions

Using Functions to Work with Different Forms of Data

How Function Calls Are Handled by the Microprocessor

LESSON 8: Pointers and References Explained

What Is a Pointer?

Dynamic Memory Allocation

Common Programming Mistakes When Using Pointers

Pointer Programming Best-Practices

What Is a Reference?


PART II: FUNDAMENTALS OF OBJECT-ORIENTED C++ PROGRAMMING


LESSON 9: Classes and Objects

The Concept of Classes and Objects

Keywords public and private

Constructors

Destructor

Copy Constructor

Different Uses of Constructors and Destructor

this Pointer

sizeof() a Class

How struct Differs from class

Declaring a friend of a class

LESSON 10: Implementing Inheritance

Basics of Inheritance

Private Inheritance

Protected Inheritance

The Problem of Slicing

Multiple Inheritance

LESSON 11: Polymorphism

Basics of Polymorphism

Using virtual Inheritance to Solve the Diamond Problem

Virtual Copy Constructors?

LESSON 12: Operator Types and Operator Overloading

What Are Operators in C++?

Unary Operators

Binary Operators

Function Operator ()

Operators That Cannot Be Overloaded

LESSON 13: Casting Operators

The Need for Casting

Why C-Style Casts Are Not Popular with Some C++ Programmers

The C++ Casting Operators

Problems with the C++ Casting Operators

LESSON 14: An Introduction to Macros and Templates

The Preprocessor and the Compiler

Using #define Macros to Define Constants

Using #define To Write Macro Functions

An Introduction to Templates


PART III: LEARNING THE STANDARD TEMPLATE LIBRARY (STL)


LESSON 15: An Introduction to the Standard Template Library

STL Containers

STL Iterators

STL Algorithms

The Interaction Between Containers and Algorithms Using Iterators

STL String Classes

LESSON 16: The STL String Class

The Need for String Manipulation Classes

Working with the STL String Class

LESSON 17: STL Dynamic Array Classes

The Characteristics of std::vector

Typical Vector Operations

Understanding the Concepts of Size and Capacity

The STL deque Class

LESSON 18: STL list and forward_list

The Characteristics of a std::list

Basic list Operations

Reversing and Sorting Elements in a List

LESSON 19: STL Set Classes

An Introduction to STL Set Classes

Basic STL set and multiset Operations

Pros and Cons of Using STL set and multiset

LESSON 20: STL Map Classes

An Introduction to STL Map Classes

Basic std::map and std::multimap Operations

Supplying a Custom Sort Predicate


PART IV: MORE STL


LESSON 21: Understanding Function Objects

The Concept of Function Objects and Predicates

Typical Applications of Function Objects

LESSON 22: C++11 Lambda Expressions

What Is a Lambda Expression?

How to Define a Lambda Expression

Lambda Expression for a Unary Function

Lambda Expression for a Unary Predicate

Lambda Expression with State via Capture Lists

The Generic Syntax of Lambda Expressions

Lambda Expression for a Binary Function

Lambda Expression for a Binary Predicate

LESSON 23: STL Algorithms

What Are STL Algorithms?

Classification of STL Algorithms

Usage of STL Algorithms

LESSON 24: Adaptive Containers: Stack and Queue

The Behavioral Characteristics of Stacks and Queues

Using the STL stack Class

Using the STL queue Class

Using the STL Priority Queue

LESSON 25: Working with Bit Flags Using STL

The bitset Class

Using std::bitset and Its Members

The vector


PART V: ADVANCED C++ CONCEPTS


LESSON 26: Understanding Smart Pointers

What Are Smart Pointers?

How Are Smart Pointers Implemented?

Types of Smart Pointers

Popular Smart Pointer Libraries

LESSON 27: Using Streams for Input and Output

Concept of Streams

Important C++ Stream Classes and Objects

Using std::cout for Writing Formatted Data to Console

Using std::cin for Input

Using std::fstream for File Handling

Using std::stringstream for String Conversions

LESSON 28: Exception Handling

What Is an Exception?

What Causes Exceptions?

Implementing Exception Safety via try and catch

How Exception Handling Works

LESSON 29: Going Forward

What's Different in Today's Processors?

How to Better Use Multiple Cores

Writing Great C++ Code

Learning C++ Doesn't Stop Here!


APPENDIXES

A: Working with Numbers: Binary and Hexadecimal

B: C++ Keywords

C: Operator Precedence

D: Answers

E: ASCII Codes

Purchase Info ?

With CourseSmart eTextbooks and eResources, you save up to 60% off the price of new print textbooks, and can switch between studying online or offline to suit your needs.

Once you have purchased your eTextbooks and added them to your CourseSmart bookshelf, you can access them anytime, anywhere.

Buy Access

Sams Teach Yourself C++ in One Hour a Day, CourseSmart eTextbook
Format: Safari Book

$22.49 | ISBN-13: 978-0-13-278653-9