Register your product to gain access to bonus material or receive a coupon.
Sams Teach Yourself C++ in 21 Days, Fourth Edition provides a straight-forward tutorial approach to programming in C++. It assumes no prior knowledge of programming and offers both solid instruction and the authors insights into best programming and learning practices. The book also provides a foundation for understanding object-oriented programming.
Working with C++ Variables and Constants
(NOTE: Each chapter concludes with a Summary, Q&A, and Workshop.)
WEEK 1. AT A GLANCE.Day 1. Getting Started.
Introduction. A Brief History of C++. How C++ Evolved. Should I Learn C First? C++ and Java and C#. The ANSI Standard. Preparing to Program. Your Development Environment. Creating the Program. The Development Cycle. HELLO.cpp-Your First C++ Program. Getting Started with Your Compiler. Compile Errors.Day 2. The Anatomy of a C++ Program.
A Simple Program. A Brief Look at cout. Using the Standard Namespace. Comments. Functions.Day 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. Characters. Constants. Enumerated Constants.Day 4. Expressions and Statements.
Statements. Expressions. Operators. Combining the Assignment and Mathematical Operators. Increment and Decrement. Precedence. Nesting Parentheses. The Nature of Truth. The if Statement. Using Braces in Nested if Statements. Logical Operators. Short Circuit Evaluation. Relational Precedence. More About Truth and Falsehood. Conditional (Ternary) Operator.Day 5. Functions.
What Is a Function? Return Values, Parameters, and Arguments. Declaring and Defining Functions. Execution of Functions. Local Variables. Global Variables. Global Variables: A Word of Caution. More on Local Variables. Function Statements. More About Function Arguments. Parameters Are Local Variables. More About Return Values. Default Parameters. Overloading Functions. Special Topics About Functions. How Functions Work-A Peek Under the Hood.Day 6. Object-Oriented Programming.
Is C++ Object-Oriented? Creating New Types. Classes and Members. Accessing Class Members. Private Versus Public. Implementing Class Methods. Constructors and Destructors. const Member Functions. Interface Versus Implementation. Where to Put Class Declarations and Method Definitions. Inline Implementation. Classes with Other Classes as Member Data. Structures.Day 7. More Program Flow.
Looping. while Loops. do...while Loops. do...while. for Loops. Summing Up Loops. switch Statements.Week 1. In Review.
WEEK 2. AT A GLANCE.Day 8. Pointers.
What Is a Pointer? Why Would You Use Pointers? The Stack and the Free Store (Heap). Memory Leaks. Creating Objects on the Free Store. Deleting Objects. Accessing Data Members. Member Data on the Free Store. The this Pointer. Stray, Wild, or Dangling Pointers. const Pointers. Pointer Arithmetic-An Advanced Topic.Day 9. References.
What Is 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. Passing by Reference for Efficiency. When to Use References and When to Use Pointers. Mixing References and 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?Day 10. Advanced Functions.
Overloaded Member Functions. Using Default Values. Choosing Between Default Values and Overloaded Functions. The Default Constructor. Overloading Constructors. Initializing Objects. The Copy Constructor. Operator Overloading. Handling Data Type Conversion.Day 11. Object-Oriented Analysis and Design.
Building Models. Software Design: The Modeling Language. Software Design: The Process. Extreme Programming. The Vision. Requirements Analysis. Design.Day 12. Inheritance.
What Is Inheritance? Private Versus Protected. Constructors and Destructors. Overriding Functions. Virtual Methods.Day 13. Arrays and Linked Lists.
What Is an Array? Array Elements. Writing Past the End of an Array. Fence Post Errors. Initializing Arrays. Declaring Arrays. Arrays of Objects. Multidimensional Arrays. Initializing Multidimensional Arrays. A Word About Memory. Arrays of Pointers. Declaring Arrays on the Free Store. A Pointer to an Array Versus an Array of Pointers. Pointers and Array Names. Deleting Arrays on the Free Store. char Arrays. strcpy() and strncpy(). String Classes. Linked Lists and Other Structures. A Linked List Case Study. The Component Parts. What Have You Learned, Dorothy? Array Classes.Day 14. Polymorphism.
Problems with Single Inheritance. Multiple Inheritance. Abstract Data Types.Week 2. In Review.
WEEK 3. AT A GLANCE.Day 15. Special Classes and Functions.
Static Member Data. Static Member Functions. Pointers to Functions. Pointers to Member Functions.Day 16. Advanced Inheritance.
Containment. Implementation in Terms of Inheritance/ Containment Versus Delegation. Private Inheritance. Friend Classes. Friend Functions. Friend Functions and Operator Overloading. Overloading the Insertion Operator.Day 17. Streams.
Overview of Streams. Streams and Buffers. Standard I/O Objects. Redirection. Input Using cin. Other Member Functions of cin. Output with cout. Related Functions. Manipulators, Flags, and Formatting Instructions. Streams Versus the printf() Function. File Input and Output. ofstream. Binary Versus Text Files. Command-Line Processing.Day 18. Namespaces.
Getting Started. Functions and Classes Are Resolved by Name. Creating a Namespace. Using a Namespace. The using Keyword. The Namespace Alias. The Unnamed Namespace. The Standard Namespace std.Day 19. Templates.
What Are Templates? Parameterized Types. Template Definition. Template Functions. Templates and Friends. Using Template Items. The Standard Template Library. Containers. Understanding Sequence Containers. Stacks. Understanding Queues. Understanding Associative Containers. Algorithm Classes.Day 20. Exceptions and Error Handling.
Bugs, Errors, Mistakes, and Code Rot. Exceptions. Using try Blocks and catch Blocks. Data in Exceptions and Naming Exception Objects. Exceptions and Templates. Exceptions Without Errors. A Word About Code Rot. Bugs and Debugging.Day 21. What's Next.
The Preprocessor and the Compiler. Seeing the Intermediate Form. Using #define. Inclusion and Inclusion Guards. Macro Functions. Inline Functions. String Manipulation. Predefined Macros. assert(). Bit Twiddling. Style. Next Steps.Week 3. In Review.
APPENDIXES.Appendix A. Binary and Hexadecimal.
Other Bases. Around the Bases. Hexadecimal.Appendix B. C++ Keywords.