

Beschreibung
If you need to know C++, look no further! This comprehensive guide has everything you need to master the modern C++23 language, from syntax fundamentals to advanced development concepts. Follow practical code examples as you learn object-oriented programming,...If you need to know C++, look no further! This comprehensive guide has everything you need to master the modern C++23 language, from syntax fundamentals to advanced development concepts. Follow practical code examples as you learn object-oriented programming, work with standard library containers, program concurrent applications, and more. Don't just learn how to code-learn how to code better with expert tips and guidance on the rules of compact, secure, and efficient code.
In this book, you'll learn about:
a. Basic to Advanced Programming
Master C++ programming from the ground up. Learn how to code with building blocks such as comments, variables, and functions, and then walk through object-oriented programming. Graduate to advanced concepts, including pointers and templates.
b. The Standard Library
Dive into the C++ standard library, including an in-depth guide to containers: what they can do, what they can't do, and how to choose the right one for your scenario. Work with streams and files, explore unique syntax, and implement concurrency using threads.
c. Good Coding Practices
Write effective, sustainable code. Dedicated chapters provide guidelines, techniques, and tips for good coding. Put theory into practice with numerous sample programs that you can download to help jump-start your own projects.
Highlights include:
1) Language basics
2) Statements and expressions
3) Structures and classes
4) Object-oriented programming
5) Containers
6) Threading
7) Error handling
8) Testing
9) Pointers
10) Interface to C
11) Templates
12) Best practices
Learn to use the standard library and containers
Autorentext
Torsten T. Will is a C++ expert who has been fascinated by the language since earning his degree in computer science. In addition to C++, he has worked with numerous other languages over the course of his career, including Python, Java, and Haskell. Since 2004, he has contributed his expertise to c't, a German magazine for computer technology, where he writes about C++ and Python. In his free time, he enjoys photography.
Inhalt
... Preface ... 27
PART I ... Fundamentals ... 31
1 ... C++: The Comprehensive Guide ... 33
1.1 ... New and Modern ... 33
1.2 ... Dan Chapters ... 34
1.3 ... Presentation in This Book ... 35
1.4 ... Formatting Used ... 35
1.5 ... Let's Talk Lingo ... 36
2 ... Programming in C++ ... 37
2.1 ... Compiling ... 38
2.2 ... Translation Phases ... 39
2.3 ... Current Compilers ... 39
2.4 ... Development Environments ... 41
2.5 ... The Command Line under Ubuntu ... 43
2.6 ... The Visual Studio Code IDE under Windows ... 46
2.7 ... Speed Up the Sample Program ... 53
3 ... C++ for Newcomers ... 55
4 ... The Basic Building Blocks of C++ ... 63
4.1 ... A Quick Overview ... 66
4.2 ... A Detailed Walkthrough ... 70
4.3 ... Operators ... 97
4.4 ... Built-In Data Types ... 111
4.5 ... Undefined Behavior ... 149
5 ... Good Code, 1st Dan: Writing Readable Code ... 151
5.1 ... Comments ... 151
5.2 ... Documentation ... 152
5.3 ... Indentations and Line Length ... 153
5.4 ... Lines per Function and File ... 154
5.5 ... Brackets and Spaces ... 154
5.6 ... Names ... 156
6 ... Higher Data Types ... 159
6.1 ... The String Type string ... 160
6.2 ... Streams ... 166
6.3 ... Container and Pointer ... 172
6.4 ... The Simple Sequence Containers ... 174
6.5 ... Algorithms ... 179
6.6 ... Pointers and C-Arrays ... 180
7 ... Functions ... 181
7.1 ... Declaration and Definition of a Function ... 182
7.2 ... Function Type ... 183
7.3 ... Using Functions ... 184
7.4 ... Defining a Function ... 185
7.5 ... More about Parameters ... 186
7.6 ... Functional Body ... 190
7.7 ... Converting Parameters ... 192
7.8 ... Overloading Functions ... 194
7.9 ... Default Parameter ... 196
7.10 ... Arbitrary Number of Arguments ... 198
7.11 ... Alternative Notation for Function Declaration ... 198
7.12 ... Specialties ... 199
8 ... Statements in Detail ... 203
8.1 ... The Statement Block ... 206
8.2 ... The Empty Statement ... 208
8.3 ... Declaration Statement ... 209
8.4 ... The Expression Statement ... 211
8.5 ... The if Statement ... 212
8.6 ... The while Loop ... 216
8.7 ... The do-while Loop ... 218
8.8 ... The for Loop ... 219
8.9 ... The Range-Based for Loop ... 221
8.10 ... The switch Statement ... 222
8.11 ... The break Statement ... 227
8.12 ... The continue Statement ... 228
8.13 ... The return Statement ... 228
8.14 ... The goto Statement ... 229
8.15 ... The try-catch Block and throw ... 231
8.16 ... Summary ... 232
9 ... Expressions in Detail ... 233
9.1 ... Calculations and Side Effects ... 234
9.2 ... Types of Expressions ... 235
9.3 ... Literals ... 236
9.4 ... Identifiers ... 237
9.5 ... Parentheses ... 237
9.6 ... Function Call and Index Access ... 238
9.7 ... Assignment ... 238
9.8 ... Type Casting ... 240
10 ... Error Handling ... 243
10.1 ... Error Handling with Error Codes ... 245
10.2 ... What Is an Exception? ... 248
10.3 ... Minor Error Handling ... 251
10.4 ... Throwing the Exception Again: rethrow ... 251
10.5 ... The Order in catch ... 252
10.6 ... Types for Exceptions ... 254
10.7 ... When an Exception Falls Out of main ... 255
11 ... Good Code, 2nd Dan: Modularization ... 257
11.1 ... Program, Library, Object File ... 257
11.2 ... Modules ... 258
11.3 ... Separating Functionalities ... 259
11.4 ... A Modular Example Project ... 260
PART II ... Object-Oriented Programming and More ... 273
12 ... From Structure to Class ... 275
12.1 ... Initialization ... 278
12.2 ... Returning Custom Types ... 279
12.3 ... Methods Instead of Functions ... 280
12.4 ... The Better print ... 283
12.5 ... An Output Like Any Other ... 285
12.6 ... Defining Methods Inline ... 286
12.7 ... Separate Implementation and Definition ... 287
12.8 ... Initialization via Constructor ... 288
12.9 ... Struct or Class? ... 295
12.10 ... Interim Recap ... 299
12.11 ... Using Custom Data Types ... 300
12.12 ... Type Inference with auto ... 315
12.13 ... Custom Classes in Standard Containers ... 319
13 ... Namespaces and Qualifiers ... 323
13.1 ... The std Namespace ... 324
13.2 ... Anonymous Namespace ... 327
13.3 ... static Makes Local ... 329
13.4 ... static Likes to Share ... 330
13.5 ... Remote Initialization or static inline Data Fields ... 332
13.6 ... Guaranteed to Be Initialized at Compile Time with constinit ... 333
13.7 ... static Makes Permanent ... 333
13.8 ... inline namespace ... 335
13.9 ... Interim Recap ... 336
13.10 ... const ... 337
13.11 ... Volatile with volatile ... 357
14 ... Good Code, 3rd Dan: Testing ... 361
14.1 ... Types of Tests ... 361
14.2 ... Frameworks ... 368
14.3 ... Boost.Test ... 372
14.4 ... Helper Macros for Assertions ... 376
14.5 ... An Example Project with Unit Tests ... 379
15 ... Inheritance ... 391
15.1 ... Relationships ... 392
15.2 ... Inheritance in C++ ... 394
15.3 ... Ha…
