C++ in 24 Hours, Sams Teach Yourself VitalSource eText (6e) : 9780134192550

C++ in 24 Hours, Sams Teach Yourself VitalSource eText (6e)

Published by
Pearson Higher Ed USA
Title type
NZ/Pacific customers only
This eText can only be purchased by people residing in New Zealand, Fiji, Samoa, Tonga or Cook Islands with a credit card from the same country. Click here to find the Pearson website for your region.

Digital Access Code. When you buy a VitalSource eText you will receive a unique digital redemption code and instructions on how to access this product. Please note: VitalSource eTexts are available for download immediately and cannot be returned once purchased.

Pearson VitalSource eTexts – digital books that fit your portable lifestyle

With Pearson VitalSource eTexts you can:

  • search for key concepts, words and phrases
  • make highlights and notes as you read or study
  • share your notes with friends
  • print up to 5 pages at a time 
  • use with PCs, MACs, smartphones and tablets 

The full text downloaded to your computer

Pearson VitalSource eTexts are downloaded to your computer and are accessed through the free VitalSource Bookshelf either offline or online, and also via the iPad/Android apps.

Time Limit

Pearson's Higher Education and Professional VitalSource products do not have an expiry date. You will continue to access your VitalSource products whilst you have your VitalSource Bookshelf installed.

Find out more about VitalSource eTexts

About the book

A hands-on guide to the C++ programming language, students are provided with short, practical examples of that illustrate key concepts, syntax, and techniques. Beginners with no previous programming experience learn about such fundamentals as managing I/O, loops and arrays, object-oriented programming, templates, and creating C++ applications - all in a cross-platform, standards-based manner.

Table of contents
Introduction 1
Hour 1: Writing Your First Program 5
Using C++ 5
Compiling and Linking the Source Code 6
Creating Your First Program 7
Hour 2: Organizing the Parts of a Program 13
Reasons to Use C++ 13
The Parts of a Program 17
Comments 19
Functions 20
Hour 3: Creating Variables and Constants 27
What Is a Variable? 27
Defining a Variable 32
Assigning Values to Variables 33
Using Type Definitions 34
Constants 36
Auto-Typed Variables 38
Hour 4: Using Expressions, Statements, and Operators 43
Statements 43
Expressions 44
Operators 45
If-Else Conditional Statements 52
Logical Operators 56
Tricky Expression Values 58
Hour 5: Calling Functions 61
What Is a Function? 61
Declaring and Defining Functions 61
Using Variables with Functions 64
Function Parameters 67
Returning Values from Functions 68
Default Function Parameters 70
Overloading Functions 72
Auto-Typed Return Values 73
Hour 6: Controlling the Flow of a Program 79
Looping 79
while Loops 79
do-while Loops 83
for Loops 84
switch Statements 89
Hour 7: Storing Information in Arrays and Strings 95
What Is an Array? 95
Writing Past the End of Arrays 97
Initializing Arrays 98
Multidimensional Arrays 99
Character Arrays 102
Copying Strings 104
Reading Arrays with Foreach Loops 105

Hour 8: Creating Basic Classes 109
What Is a Type? 109
Creating New Types 110
Classes and Members 110
Accessing Class Members 112
Private Versus Public Access 112
Implementing Member Functions 114
Creating and Deleting Objects 116
Hour 9: Moving into Advanced Classes 123
const Member Functions 123
Interface Versus Implementation 124
Organizing Class Declarations and Function Definitions 124
Inline Implementation 124
Classes with Other Classes as Member Data 127

Hour 10: Creating Pointers 135
Understanding Pointers and Their Usage 135
The Stack and the Heap 145
Null Pointer Constant 150
Hour 11: Developing Advanced Pointers 155
Creating Objects on the Heap 155
Deleting Objects 155
Accessing Data Members Using Pointers 157
Member Data on the Heap 158
The this Pointer 160
Stray or Dangling Pointers 161
const Pointers 162
const Pointers and const Member Functions 163
Hour 12: Creating References 167
What is a Reference? 167
Creating a Reference 167
Using the Address of Operator on References 169
What Can Be Referenced? 171
Null Pointers and Null References 172
Passing Function Arguments by Reference 172
Understanding Function Headers and Prototypes 177
Returning Multiple Values 177
Hour 13: Developing Advanced References and Pointers 183
Passing by Reference for Efficiency 183
Passing a const Pointer 186
References as an Alternative to Pointers 189
When to Use References and When to Use Pointers 191
References to Objects Not in Scope 191
Returning a Reference to an Object on the Heap 192
Pointer, Pointer, Who Has the Pointer? 195

Hour 14: Calling Advanced Functions 199
Overloaded Member Functions 199
Using Default Values 201
Initializing Objects 203
The Copy Constructor 204
Compile-Time Constant Expressions 208
Hour 15: Using Operator Overloading 213
Operator Overloading 213
Conversion Operators 224

Hour 16: Extending Classes with Inheritance 231
What Is Inheritance? 231
Private Versus Protected 234
Constructors and Destructors 236
Passing Arguments to Base Constructors 239
Overriding Functions 244
Hour 17: Using Polymorphism and Derived Classes 251
Polymorphism Implemented with Virtual Member Functions 251
How Virtual Member Functions Work 256
Hour 18: Making Use of Advanced Polymorphism 267
Problems with Single Inheritance 267
Abstract Data Types 271

Hour 19: Storing Information in Linked Lists 287
Linked Lists and Other Structures 287
Linked List Case Study 289
Linked Lists as Objects 298
Hour 20: Using Special Classes, Functions, and Pointers 301
Static Member Data 301
Static Member Functions 303
Containment of Classes 305
Friend Classes and Functions 312
Hour 21: Using New Features of C++14 331
The Newest Version of C++ 331
Using auto in Function Return Types 332
Improved Numeric Literals 334
The constexpr Keyword 335
Lambda Expressions 338
Hour 22: Employing Object-Oriented Analysis and Design 343
The Development Cycle 343
Simulating an Alarm System 344
PostMaster: A Case Study 350
Hour 23: Creating Templates 373
What Are Templates? 373
Instances of the Template 374
Template Definition 374
Using Template Items 381
Hour 24: Dealing with Exceptions and Error Handling 391
Bugs, Errors, Mistakes, and Code Rot 391
Handling the Unexpected 392
Exceptions 393
Using try and catch Blocks 397
Writing Professional-Quality Code 403

Appendix A: Binary and Hexadecimal 411
Other Bases 412
Around the Bases 412
Hexadecimal 416
Appendix B: Glossary 419
Appendix C: This Book’s Website 427
Appendix D: Using the MinGW C++ Compiler on Windows 429
Downloading MinGW-w64 429
Setting the Path Environment Variable 431
Testing Your Installation 433
Index 439
Access Code info.

To get the most out of your Pearson VitalSource eText you need to download the VitalSource Bookshelf software. This software is free to download and use. Click here to view the VitalSource Bookshelf system requirements.

Download Information: Once purchased, you can view and/or download your VitalSource eText instantly, either via the download link which you will receive as soon as you complete your online order or by viewing the download link against the order in the My Account area of this website.

Please note: VitalSource eTexts are available for download immediately and cannot be returned once purchased.