Introduction |
|
1 | (4) |
|
|
|
Hour 1 Writing Your First Program |
|
|
5 | (8) |
|
|
5 | (1) |
|
Compiling and Linking the Source Code |
|
|
6 | (1) |
|
Creating Your First Program |
|
|
7 | (6) |
|
Hour 2 Organizing the Parts of a Program |
|
|
13 | (14) |
|
|
13 | (4) |
|
|
17 | (2) |
|
|
19 | (1) |
|
|
20 | (7) |
|
Hour 3 Creating Variables and Constants |
|
|
27 | (16) |
|
|
27 | (5) |
|
|
32 | (1) |
|
Assigning Values to Variables |
|
|
33 | (1) |
|
|
34 | (2) |
|
|
36 | (2) |
|
|
38 | (5) |
|
Hour 4 Using Expressions, Statements, and Operators |
|
|
43 | (18) |
|
|
43 | (1) |
|
|
44 | (1) |
|
|
45 | (7) |
|
If-Else Conditional Statements |
|
|
52 | (4) |
|
|
56 | (2) |
|
|
58 | (3) |
|
|
61 | (18) |
|
|
61 | (1) |
|
Declaring and Defining Functions |
|
|
61 | (3) |
|
Using Variables with Functions |
|
|
64 | (3) |
|
|
67 | (1) |
|
Returning Values from Functions |
|
|
68 | (2) |
|
Default Function Parameters |
|
|
70 | (2) |
|
|
72 | (1) |
|
|
73 | (6) |
|
Hour 6 Controlling the Flow of a Program |
|
|
79 | (16) |
|
|
79 | (1) |
|
|
79 | (4) |
|
|
83 | (1) |
|
|
84 | (5) |
|
|
89 | (6) |
|
Hour 7 Storing Information in Arrays and Strings |
|
|
95 | (14) |
|
|
95 | (2) |
|
Writing Past the End of Arrays |
|
|
97 | (1) |
|
|
98 | (1) |
|
|
99 | (3) |
|
|
102 | (2) |
|
|
104 | (1) |
|
Reading Arrays with Foreach Loops |
|
|
105 | (4) |
|
|
|
Hour 8 Creating Basic Classes |
|
|
109 | (14) |
|
|
109 | (1) |
|
|
110 | (1) |
|
|
110 | (2) |
|
|
112 | (1) |
|
Private Versus Public Access |
|
|
112 | (2) |
|
Implementing Member Functions |
|
|
114 | (2) |
|
Creating and Deleting Objects |
|
|
116 | (7) |
|
Hour 9 Moving into Advanced Classes |
|
|
123 | (12) |
|
|
123 | (1) |
|
Interface Versus Implementation |
|
|
124 | (1) |
|
Organizing Class Declarations and Function Definitions |
|
|
124 | (1) |
|
|
124 | (3) |
|
Classes with Other Classes as Member Data |
|
|
127 | (8) |
|
Part III Memory Management |
|
|
|
Hour 10 Creating Pointers |
|
|
135 | (20) |
|
Understanding Pointers and Their Usage |
|
|
135 | (10) |
|
|
145 | (5) |
|
|
150 | (5) |
|
Hour 11 Developing Advanced Pointers |
|
|
155 | (12) |
|
Creating Objects on the Heap |
|
|
155 | (1) |
|
|
155 | (2) |
|
Accessing Data Members Using Pointers |
|
|
157 | (1) |
|
|
158 | (2) |
|
|
160 | (1) |
|
Stray or Dangling Pointers |
|
|
161 | (1) |
|
|
162 | (1) |
|
Const Pointers and const Member Functions |
|
|
163 | (4) |
|
Hour 12 Creating References |
|
|
167 | (16) |
|
|
167 | (1) |
|
|
167 | (2) |
|
Using the Address of Operator on References |
|
|
169 | (2) |
|
|
171 | (1) |
|
Null Pointers and Null References |
|
|
172 | (1) |
|
Passing Function Arguments by Reference |
|
|
172 | (5) |
|
Understanding Function Headers and Prototypes |
|
|
177 | (1) |
|
Returning Multiple Values |
|
|
177 | (6) |
|
Hour 13 Developing Advanced References and Pointers |
|
|
183 | (16) |
|
Passing by Reference for Efficiency |
|
|
183 | (3) |
|
|
186 | (3) |
|
References as an Alternative to Pointers |
|
|
189 | (2) |
|
When to Use References and When to Use Pointers |
|
|
191 | (1) |
|
References to Objects Not in Scope |
|
|
191 | (1) |
|
Returning a Reference to an Object on the Heap |
|
|
192 | (3) |
|
Pointer, Pointer, Who Has the Pointer? |
|
|
195 | (4) |
|
|
|
Hour 14 Calling Advanced Functions |
|
|
199 | (14) |
|
Overloaded Member Functions |
|
|
199 | (2) |
|
|
201 | (2) |
|
|
203 | (1) |
|
|
204 | (4) |
|
Compile-Time Constant Expressions |
|
|
208 | (5) |
|
Hour 15 Using Operator Overloading |
|
|
213 | (18) |
|
|
213 | (11) |
|
|
224 | (7) |
|
Part V Inheritance and Polymorphism |
|
|
|
Hour 16 Extending Classes with Inheritance |
|
|
231 | (20) |
|
|
231 | (3) |
|
|
234 | (2) |
|
Constructors and Destructors |
|
|
236 | (3) |
|
Passing Arguments to Base Constructors |
|
|
239 | (5) |
|
|
244 | (7) |
|
Hour 17 Using Polymorphism and Derived Classes |
|
|
251 | (16) |
|
Polymorphism Implemented with Virtual Member Functions |
|
|
251 | (5) |
|
How Virtual Member Functions Work |
|
|
256 | (11) |
|
Hour 18 Making Use of Advanced Polymorphism |
|
|
267 | (20) |
|
Problems with Single Inheritance |
|
|
267 | (4) |
|
|
271 | (16) |
|
|
|
Hour 19 Storing Information in Linked Lists |
|
|
287 | (14) |
|
Linked Lists and Other Structures |
|
|
287 | (2) |
|
|
289 | (9) |
|
|
298 | (3) |
|
Hour 20 Using Special Classes, Functions, and Pointers |
|
|
301 | (30) |
|
|
301 | (2) |
|
|
303 | (2) |
|
|
305 | (7) |
|
Friend Classes and Functions |
|
|
312 | (19) |
|
Hour 21 Using New Features of C++14 |
|
|
331 | (12) |
|
The Newest Version of C++ |
|
|
331 | (1) |
|
Using auto in Function Return Types |
|
|
332 | (2) |
|
Improved Numeric Literals |
|
|
334 | (1) |
|
|
335 | (3) |
|
|
338 | (5) |
|
Hour 22 Employing Object-Oriented Analysis and Design |
|
|
343 | (30) |
|
|
343 | (1) |
|
Simulating an Alarm System |
|
|
344 | (6) |
|
|
350 | (23) |
|
Hour 23 Creating Templates |
|
|
373 | (18) |
|
|
373 | (1) |
|
Instances of the Template |
|
|
374 | (1) |
|
|
374 | (7) |
|
|
381 | (10) |
|
Hour 24 Dealing with Exceptions and Error Handling |
|
|
391 | (20) |
|
Bugs, Errors, Mistakes, and Code Rot |
|
|
391 | (1) |
|
|
392 | (1) |
|
|
393 | (4) |
|
Using try and catch Blocks |
|
|
397 | (6) |
|
Writing Professional-Quality Code |
|
|
403 | (8) |
|
|
|
Appendix A Binary and Hexadecimal |
|
|
411 | (8) |
|
|
412 | (1) |
|
|
412 | (4) |
|
|
416 | (3) |
|
|
419 | (8) |
|
Appendix C This Book's Website |
|
|
427 | (2) |
|
Appendix D Using the MinGW C++ Compiler on Windows |
|
|
429 | (10) |
|
|
429 | (2) |
|
Setting the Path Environment Variable |
|
|
431 | (2) |
|
Testing Your Installation |
|
|
433 | (6) |
Index |
|
439 | |