Home Page Icon
Home Page
Table of Contents for
Index
Close
Index
by Jesse Liberty
SAMS Teach Yourself C++ in 10 Minutes SECOND EDITION
Copyright
About the Authors
Acknowledgments
We Want to Hear from You!
Introduction
Getting Started
The Mission
The C++ Language
Preparing to Program
C++, ANSI C++, Windows, and Other Areas of Confusion
Your Compiler and Editor
The Development Cycle
Evolving the Program
A Simple Program
Parts of the Program
Compile-Time Errors
Summing Up
Output to the Console—Standard Output
Enhancing the Empty Program
The #include, Character by Character
Namespaces
Comments
Whitespace
Functions
The cout Statement, Word by Word
Summing Up
Calculations
Performing and Displaying a Calculation
Nesting Parentheses
Using an Input Stream
Using int Variables and Constants
Types of Variables and Valid Names
Summing Up
Numeric Input
Numeric Input
What Went Wrong?
Summing Up
if Statements and Program Decisions
Dealing with a Failed Input Stream
Summing Up
Exception Handling
Exception Handling—A Better Way
Why Use Exceptions?
Summing Up
Functions
What Is a Function?
Defining Functions
Breaking the Example into Functions
Refactoring
Where You Put Function Code
Global Variables
Testing
Summing Up
Separating Code into Modules
What Is a Module?
Why Use a Module?
Making a Library Changes Your Names
Calling the Functions
Compiling Separately
Testing
Summing Up
do/while Loops
Where You Are
Doing Things More Than Once
Doing Things at Least Once
Doing Things Zero or More Times
Summing Up
Nested Loops and Complex bool Expressions
Nesting Loops
Relational Operators
Simplifying by Using a bool Variable
Summing Up
switch Statements, static Variables, and runtime_errors
switch Statements
Generalizing the Calculator
Dealing with the New Exception
Summing Up
Arrays, Loops, and the Increment and Decrement Operators
Using an Array to Create a Calculator Tape
The Tape
The for Loop
Writing Past the End of an Array
Incrementing and Decrementing
The Calculator Tape in the Accumulator
Summing Up
Storage: Heaps, Stacks, and Pointing
Heaps Versus Stacks
Pointers, References, and Arrays
Pointers Are Dangerous
Deleting from the Heap
Deleting Arrays
Summing Up
Testing
Why Storage from the Heap Makes Testing Critical
Making the Calculator More General with a “Little Language”
Debugging Without a Debugger
Summing Up
Structures and Types
Getting Organized
Declaring Enumerated Types
Declaring Structure Types
Structures on the Stack
Structures from the Heap
A Unidirectional Linked List with Structures for the Tape
Function Pointers and Callbacks
Summing Up
File I/O
Saving the Tape Between Sessions
Recalling the Tape
Replaying the Tape to Restore State
Summing Up
Classes: Structures with Functions
The Class as a Mini-Program
Classes Versus Instances
Constructors and Destructors
The Copy Constructor and When You Need It
Relaxing “Declare Before Use” Within Classes
Summing Up
Refactoring the Calculator with Classes
Moving Functions into Classes
Summing Up
Implementing the Calculator as Classes
Class Notation
The Private and Public Members of aRequest
Initialization
Internal State
Naming
Moving Function Content into Member Functions
The Object as Callback Structure
Who Allocates, Who Deletes, Who Uses, What's Shared
Summing Up
The Rest of the Calculator as Classes
Using a Standard C++ Library Class
The User Interface in an Object
The main.cpp
Summing Up
Function and Operator Overloading
Declaring Overloaded Member Functions in a Class
Overloaded Constructors
What Does It Mean to Overload an Operator?
Operator Overloading Can Be Dangerous
Overloading Assignment and the Copy Constructor
Summing Up
Inheritance
Declaring Inheritance
Referring to an Object as Its Class or Its Superclass
Overriding Functions
Protected Access
What Is virtual?
Virtual Constructors and Destructors
Virtual Member Functions
Calling the Superclass
Summing Up
Object Testing Using Inheritance
Writing Test Harnesses
Testing the Classes with Known Cases
Regression Testing
Summing Up
Abstract Classes, Multiple Inheritance, and Static Members
Creating Interfaces
Multiple Inheritance
Static Member Variables and Functions in Classes
Summing Up
Templates
Strengths and Weaknesses of Templates
Declaring and Using Templates
Summing Up
Performance: C++ Optimizations
Running Faster, Getting Smaller
Inlining
Incrementing and Decrementing
Templates Versus Generic Classes
Timing Your Code
Program/Data Structure Size
Summing Up
Wrapping Up
Things You Can Do to Enhance the Calculator
Lessons Learned
Operators
Operator Precedence
Index
Search in book...
Toggle Font Controls
Playlists
Add To
Create new playlist
Name your new playlist
Playlist description (optional)
Cancel
Create playlist
Sign In
Email address
Password
Forgot Password?
Create account
Login
or
Continue with Facebook
Continue with Google
Sign Up
Full Name
Email address
Confirm Email Address
Password
Login
Create account
or
Continue with Facebook
Continue with Google
Prev
Previous Chapter
Operator Precedence
Index
Add Highlight
No Comment
..................Content has been hidden....................
You can't read the all page of ebook, please click
here
login for view all page.
Day Mode
Cloud Mode
Night Mode
Reset