
Beginning C++
Description
Alles über E-Books | Antworten auf Fragen rund um E-Books, Kopierschutz und Dateiformate finden Sie in unserem Info- & Hilfebereich.
Beginning C++ is a tutorial for beginners in C++ and discusses a subset of C++ that is suitable for beginners. The language syntax corresponds to the C++14 standard. This book is environment neutral and does not presume any specific operating system or program development system. There is no assumption of prior programming knowledge.
All language concepts that are explained in the book are illustrated with working program examples. Most chapters include exercises for you to test your knowledge. Code downloads are provided for examples from the text and solutions to the exercises and there is an additional download for a more substantial project for you to try when you have finished the book.
This book introduces the elements of the C++ standard library that provide essential support for the language syntax that is discussed. While the Standard Template Library (STL) is not discussed to a significant extent, a few elements from the STL that are important to the notion of modern C++ are introduced and applied.
Beginning C++ is based on and supersedes Ivor Horton's previous book, Beginning ANSI C++.
More details
Other editions
Additional editions

Person
Content
2 - Contents [Seite 603]
3 - About the Author [Seite 619]
4 - About the Technical Reviewer [Seite 620]
5 - Introduction [Seite 5]
6 - Chapter 1: Basic Ideas [Seite 7]
6.1 - Modern C++ [Seite 7]
6.2 - C++ Program Concepts [Seite 8]
6.2.1 - Comments and Whitespace [Seite 8]
6.2.2 - Preprocessing Directives and Header Files [Seite 9]
6.2.3 - Functions [Seite 9]
6.2.4 - Statements [Seite 10]
6.2.5 - Data Input and Output [Seite 11]
6.2.6 - return Statements [Seite 11]
6.2.7 - Namespaces [Seite 11]
6.2.8 - Names and Keywords [Seite 12]
6.3 - Classes and Objects [Seite 13]
6.4 - Templates [Seite 13]
6.5 - Program Files [Seite 13]
6.6 - Standard Libraries [Seite 13]
6.7 - Code Presentation Style [Seite 13]
6.8 - Creating an Executable [Seite 14]
6.9 - Representing Numbers [Seite 15]
6.9.1 - Binary Numbers [Seite 15]
6.9.2 - Hexadecimal Numbers [Seite 17]
6.9.3 - Negative Binary Numbers [Seite 18]
6.9.4 - Octal Values [Seite 20]
6.9.5 - Big-Endian and Little-Endian Systems [Seite 20]
6.9.6 - Floating-Point Numbers [Seite 21]
6.10 - Representing Characters [Seite 22]
6.10.1 - ASCII Codes [Seite 22]
6.10.2 - UCS and Unicode [Seite 23]
6.11 - C++ Source Characters [Seite 23]
6.11.1 - Trigraph Sequences [Seite 24]
6.11.2 - Escape Sequences [Seite 24]
6.12 - Procedural and Object-Oriented Programming [Seite 26]
6.13 - Summary [Seite 27]
7 - Chapter 2: Introducing Fundamental Types of Data [Seite 29]
7.1 - Variables, Data, and Data Types [Seite 29]
7.1.1 - Defining Integer Variables [Seite 30]
7.1.2 - Defining Variables with Fixed Values [Seite 32]
7.2 - Integer Literals [Seite 32]
7.2.1 - Decimal Integer Literals [Seite 32]
7.2.1.1 - Hexadecimal Literals [Seite 33]
7.2.1.2 - Octal Literals [Seite 33]
7.2.1.3 - Binary Literals [Seite 34]
7.3 - Calculations with Integers [Seite 34]
7.3.1 - More on Assignment Operations [Seite 36]
7.4 - The op= Assignment Operators [Seite 38]
7.5 - using Declarations and Directives [Seite 40]
7.6 - The sizeof Operator [Seite 40]
7.7 - Incrementing and Decrementing Integers [Seite 41]
7.7.1 - Postfix Increment and Decrement Operations [Seite 41]
7.8 - Defining Floating-Point Variables [Seite 42]
7.9 - Floating-Point Literals [Seite 43]
7.10 - Floating-Point Calculations [Seite 44]
7.10.1 - Mathematical Functions [Seite 46]
7.11 - Formatting Stream Output [Seite 49]
7.12 - Mixed Expressions and Type Conversion [Seite 51]
7.13 - Explicit Type Conversion [Seite 53]
7.13.1 - Old-Style Casts [Seite 55]
7.14 - Finding the Limits [Seite 55]
7.15 - Working with Character Variables [Seite 56]
7.15.1 - Working with Unicode Characters [Seite 57]
7.16 - The auto Keyword [Seite 58]
7.17 - Lvalues and Rvalues [Seite 58]
7.18 - Summary [Seite 59]
8 - Chapter 3: Working with Fundamental Data Types [Seite 61]
8.1 - Operator Precedence and Associativity [Seite 61]
8.2 - Bitwise Operators [Seite 63]
8.2.1 - The Bitwise Shift Operators [Seite 64]
8.2.1.1 - Shifting Signed Integers [Seite 66]
8.2.1.2 - Logical Operations on Bit Patterns [Seite 66]
8.2.2 - Using the Bitwise AND [Seite 67]
8.2.3 - Using the Bitwise OR [Seite 68]
8.2.4 - Using the Bitwise Exclusive OR [Seite 69]
8.3 - Enumerated Data Types [Seite 73]
8.3.1 - Old-Style Enumerations [Seite 76]
8.4 - Synonyms for Data Types [Seite 76]
8.5 - The Lifetime of a Variable [Seite 77]
8.6 - Positioning Variable Definitions [Seite 77]
8.6.1 - Global Variables [Seite 77]
8.6.2 - Static Variables [Seite 81]
8.7 - External Variables [Seite 81]
8.8 - Summary [Seite 82]
9 - Chapter 4: Making Decisions [Seite 84]
9.1 - Comparing Data Values [Seite 84]
9.1.1 - Applying the Comparison Operators [Seite 85]
9.1.2 - Comparing Floating Point Values [Seite 87]
9.2 - The if Statement [Seite 87]
9.2.1 - Nested if Statements [Seite 90]
9.2.2 - Code-Neutral Character Handling [Seite 91]
9.3 - The if-else Statement [Seite 93]
9.3.1 - Nested if-else Statements [Seite 94]
9.3.2 - Understanding Nested ifs [Seite 95]
9.4 - Logical Operators [Seite 97]
9.4.1 - Logical AND [Seite 97]
9.4.2 - Logical OR [Seite 98]
9.4.3 - Logical Negation [Seite 98]
9.5 - The Conditional Operator [Seite 100]
9.6 - The switch Statement [Seite 102]
9.7 - Unconditional Branching [Seite 105]
9.8 - Statement Blocks and Variable Scope [Seite 106]
9.9 - Summary [Seite 107]
10 - Chapter 5: Arrays and Loops [Seite 109]
10.1 - Arrays [Seite 109]
10.1.1 - Using an Array [Seite 110]
10.2 - Understanding Loops [Seite 111]
10.3 - The for Loop [Seite 112]
10.4 - Avoiding Magic Numbers [Seite 114]
10.5 - Defining the Array Size with the Initializer List [Seite 115]
10.6 - Determining the Size of an Array [Seite 115]
10.7 - Controlling a for Loop with Floating-Point Values [Seite 117]
10.8 - More Complex for Loop Control Expressions [Seite 118]
10.9 - The Comma Operator [Seite 120]
10.10 - The Ranged-based for Loop [Seite 120]
10.11 - The while Loop [Seite 121]
10.12 - Allocating an Array at Runtime [Seite 123]
10.13 - The do-while Loop [Seite 125]
10.14 - Nested Loops [Seite 127]
10.15 - Skipping Loop Iterations [Seite 129]
10.16 - Breaking Out of a Loop [Seite 131]
10.16.1 - Indefinite Loops [Seite 131]
10.17 - Arrays of Characters [Seite 135]
10.18 - Multidimensional Arrays [Seite 138]
10.18.1 - Initializing Multidimensional Arrays [Seite 140]
10.18.1.1 - Setting Dimensions by Default [Seite 141]
10.18.2 - Multidimensional Character Arrays [Seite 142]
10.19 - Alternatives to Using an Array [Seite 144]
10.19.1 - Using array
10.19.2 - Using std::vector
10.19.3 - The Capacity and Size of a Vector [Seite 149]
10.19.4 - Deleting Elements from a Vector container [Seite 151]
10.20 - Summary [Seite 152]
11 - Chapter 6: Pointers and References [Seite 154]
11.1 - What Is a Pointer ? [Seite 154]
11.2 - The Address-Of Operator [Seite 156]
11.3 - The Indirection Operator [Seite 157]
11.3.1 - Why Use Pointers ? [Seite 159]
11.4 - Pointers to Type char [Seite 159]
11.4.1 - Arrays of Pointers [Seite 161]
11.5 - Constant Pointers and Pointers to Constants [Seite 163]
11.6 - Pointers and Arrays [Seite 165]
11.6.1 - Pointer Arithmetic [Seite 165]
11.6.1.1 - The Difference between Pointers [Seite 167]
11.6.2 - Using Pointer Notation with an Array Name [Seite 167]
11.7 - Dynamic Memory Allocation [Seite 170]
11.7.1 - The Stack and the Heap [Seite 170]
11.7.2 - Using the new and delete Operators [Seite 171]
11.7.3 - Dynamic Allocation of Arrays [Seite 172]
11.7.4 - Member Selection through a Pointer [Seite 174]
11.8 - Hazards of Dynamic Memory Allocation [Seite 174]
11.8.1 - Memory Leaks [Seite 175]
11.8.2 - Fragmentation of the Free Store [Seite 175]
11.9 - Raw Pointers and Smart Pointers [Seite 176]
11.9.1 - Using unique_ptr
11.9.2 - Using shared_ptr
11.9.3 - Comparing shared_ptr
11.9.4 - weak_ptr
11.10 - Understanding References [Seite 183]
11.10.1 - Defining lvalue References [Seite 184]
11.10.2 - Using a Reference Variable in a Range-Based for Loop [Seite 184]
11.10.3 - Defining rvalue References [Seite 185]
11.11 - Summary [Seite 186]
12 - Chapter 7: Working with Strings [Seite 188]
12.1 - A Better Class of String [Seite 188]
12.1.1 - Defining string Objects [Seite 189]
12.1.2 - Operations with String Objects [Seite 191]
12.1.2.1 - Concatenating Strings [Seite 191]
12.1.3 - Accessing Characters in a String [Seite 193]
12.1.4 - Accessing Substrings [Seite 195]
12.1.5 - Comparing Strings [Seite 196]
12.1.5.1 - The compare(?) Function [Seite 198]
12.1.5.2 - Comparisons Using substr(?) [Seite 200]
12.1.6 - Searching Strings [Seite 201]
12.1.6.1 - Searching for any of a Set of Characters [Seite 203]
12.1.7 - Searching a String Backwards [Seite 206]
12.1.8 - Modifying a String [Seite 207]
12.1.8.1 - Inserting a String [Seite 207]
12.1.8.2 - Replacing a Substring [Seite 208]
12.1.8.3 - Removing Characters from a String [Seite 210]
12.2 - Strings of International Characters [Seite 211]
12.2.1 - Strings of wchar_t Characters [Seite 211]
12.3 - Objects that contain Unicode Strings [Seite 212]
12.4 - Raw String Literals [Seite 212]
12.5 - Summary [Seite 213]
13 - Chapter 8: Defining Functions [Seite 215]
13.1 - Segmenting Your Programs [Seite 215]
13.1.1 - Functions in Classes [Seite 216]
13.1.2 - Characteristics of a Function [Seite 216]
13.2 - Defining Functions [Seite 216]
13.2.1 - The Function Body [Seite 218]
13.2.1.1 - Return Values [Seite 219]
13.2.1.1.1 - How the return Statement Works [Seite 219]
13.2.2 - Function Declarations [Seite 219]
13.2.2.1 - Function Prototypes [Seite 220]
13.3 - Passing Arguments to a Function [Seite 221]
13.3.1 - Pass-by-Value [Seite 221]
13.3.1.1 - Passing a Pointer to a Function [Seite 223]
13.3.1.2 - Passing an Array to a Function [Seite 224]
13.3.1.2.1 - const Pointer Parameters [Seite 225]
13.3.1.2.2 - Passing a Multidimensional Array to a Function [Seite 226]
13.3.2 - Pass-by-Reference [Seite 227]
13.3.2.1 - References Can Be Risky [Seite 228]
13.3.2.1.1 - Improving the Program [Seite 230]
13.3.2.1.2 - Simplifying Code using Type Aliases [Seite 231]
13.3.2.2 - References versus Pointers [Seite 231]
13.3.3 - Arguments to main() [Seite 232]
13.4 - Default Argument Values [Seite 233]
13.4.1 - Multiple Default Parameter Values [Seite 233]
13.5 - Returning Values from a Function [Seite 235]
13.5.1 - Returning a Pointer [Seite 235]
13.5.2 - Returning a Reference [Seite 240]
13.6 - Inline Functions [Seite 241]
13.7 - Static Variables [Seite 241]
13.8 - Function Overloading [Seite 243]
13.8.1 - Overloading and Pointer Parameters [Seite 245]
13.8.2 - Overloading and Reference Parameters [Seite 245]
13.8.3 - Overloading and const Parameters [Seite 247]
13.8.3.1 - Overloading with const Pointer Parameters [Seite 247]
13.8.3.2 - Overloading and const Reference Parameters [Seite 248]
13.8.4 - Overloading and Default Argument Values [Seite 248]
13.9 - A Sausage Machine for Functions [Seite 249]
13.9.1 - Creating Instances of a Function Template [Seite 250]
13.9.2 - Explicit Template Argument [Seite 251]
13.9.3 - Function Template Specialization [Seite 252]
13.9.4 - Function Templates and Overloading [Seite 253]
13.9.5 - Function Templates with Multiple Parameters [Seite 254]
13.9.6 - Non-Type Template Parameters [Seite 255]
13.10 - Trailing Return Types [Seite 256]
13.11 - Pointers to Functions [Seite 257]
13.11.1 - Defining Pointers to Functions [Seite 258]
13.12 - Recursion [Seite 260]
13.12.1 - Applying Recursion [Seite 263]
13.12.2 - The Quicksort Algorithm [Seite 263]
13.12.3 - The main() Function [Seite 264]
13.12.4 - The extract_words() Function [Seite 265]
13.12.5 - The swap() Function [Seite 266]
13.12.6 - The sort() function [Seite 266]
13.12.7 - The max_word_length() Function [Seite 267]
13.12.8 - The show_words() Function [Seite 268]
13.13 - Summary [Seite 269]
14 - Chapter 9: Lambda Expressions [Seite 273]
14.1 - Introducing Lambda Expressions [Seite 273]
14.2 - Defining a Lambda Expression [Seite 274]
14.3 - Naming a Lambda Expression [Seite 274]
14.4 - Passing a Lambda Expression to a Function [Seite 276]
14.4.1 - Function Templates that Accept Lambda Expression Arguments [Seite 276]
14.4.2 - A Function Parameter Type for Lambda Arguments [Seite 277]
14.4.3 - Using the std::function Template Type [Seite 278]
14.5 - The Capture Clause [Seite 281]
14.5.1 - Capturing Specific Variables [Seite 282]
14.6 - Using Lambda Expressions in a Template [Seite 283]
14.7 - Recursion in Lambda Expressions [Seite 285]
14.8 - Summary [Seite 286]
15 - Chapter 10: Program Files and Preprocessing Directives [Seite 288]
15.1 - Understanding Translation Units [Seite 288]
15.1.1 - The "One Definition" Rule [Seite 289]
15.1.2 - Program Files and Linkage [Seite 289]
15.1.3 - Determining Linkage for a Name [Seite 289]
15.1.4 - External Names [Seite 290]
15.1.5 - const Variables with External Linkage [Seite 290]
15.2 - Preprocessing Your Source Code [Seite 290]
15.3 - Defining Preprocessing Identifiers [Seite 292]
15.3.1 - Undefining an Identifier [Seite 293]
15.4 - Including Header Files [Seite 293]
15.4.1 - Preventing Duplication of Header File Contents [Seite 294]
15.5 - Namespaces [Seite 295]
15.5.1 - The Global Namespace [Seite 296]
15.5.2 - Defining a Namespace [Seite 296]
15.5.3 - Applying using Declarations [Seite 299]
15.5.4 - Functions and Namespaces [Seite 299]
15.5.5 - Unnamed Namespaces [Seite 302]
15.5.6 - Namespace Aliases [Seite 302]
15.5.7 - Nested Namespaces [Seite 303]
15.6 - Logical Preprocessing Directives [Seite 304]
15.6.1 - The Logical #if Directive [Seite 304]
15.6.2 - Testing for Specific Identifier Values [Seite 304]
15.6.3 - Multiple Choice Code Selection [Seite 305]
15.6.4 - Standard Preprocessing Macros [Seite 306]
15.7 - Debugging Methods [Seite 307]
15.7.1 - Integrated Debuggers [Seite 307]
15.7.2 - Preprocessing Directives in Debugging [Seite 308]
15.7.3 - Using the assert(?) Macro [Seite 312]
15.7.4 - Switching Off assert() Macros [Seite 312]
15.8 - Static Assertions [Seite 313]
15.9 - Summary [Seite 314]
16 - Chapter 11: Defining Your Own Data Types [Seite 316]
16.1 - Classes and Object-Oriented Programming [Seite 316]
16.1.1 - Encapsulation [Seite 317]
16.1.1.1 - Data Hiding [Seite 318]
16.1.2 - Inheritance [Seite 318]
16.1.3 - Polymorphism [Seite 319]
16.2 - Terminology [Seite 320]
16.3 - Defining a Class [Seite 321]
16.4 - Constructors [Seite 323]
16.4.1 - Defining Constructors Outside the Class [Seite 325]
16.4.2 - Default Constructor Parameter Values [Seite 327]
16.4.3 - Using a Constructor Initialization List [Seite 327]
16.4.4 - Use of the explicit Keyword [Seite 328]
16.4.5 - Delegating Constructors [Seite 330]
16.4.6 - The Copy Constructor [Seite 331]
16.4.6.1 - Implementing the Copy Constructor [Seite 332]
16.4.6.2 - Reference Parameters [Seite 332]
16.5 - Accessing Private Class Members [Seite 332]
16.6 - Friends [Seite 334]
16.6.1 - The Friend Functions of a Class [Seite 334]
16.6.2 - Friend Classes [Seite 337]
16.7 - The this Pointer [Seite 337]
16.7.1 - Returning this from a Function [Seite 338]
16.8 - const Objects and const Member Functions [Seite 339]
16.8.1 - Casting Away const [Seite 340]
16.9 - Arrays of Class Objects [Seite 341]
16.10 - The Size of a Class Object [Seite 342]
16.11 - Static Members of a Class [Seite 343]
16.11.1 - Static Data Members [Seite 343]
16.11.2 - Accessing Static Data Members [Seite 346]
16.11.3 - A Static Data Member of the Class Type [Seite 347]
16.11.4 - Static Function Members [Seite 347]
16.12 - Destructors [Seite 348]
16.13 - Pointers and References to Class Objects [Seite 351]
16.14 - Using Pointers As Class Members [Seite 351]
16.14.1 - Defining the Package Class [Seite 354]
16.14.2 - Defining the Truckload Class [Seite 355]
16.14.3 - Implementing the Truckload Class [Seite 356]
16.15 - Nested Classes [Seite 360]
16.16 - Summary [Seite 363]
17 - Chapter 12: Operator Overloading [Seite 366]
17.1 - Implementing Operators for a Class [Seite 366]
17.1.1 - Operator Overloading [Seite 367]
17.1.2 - Operators That Can Be Overloaded [Seite 367]
17.1.3 - Implementing an Overloaded Operator [Seite 368]
17.1.4 - Global Operator Functions [Seite 370]
17.1.5 - Implementing Full Support for an Operator [Seite 371]
17.1.6 - Implementing All Comparison Operators in a Class [Seite 372]
17.2 - Operator Function Idioms [Seite 374]
17.3 - Default Class Members [Seite 375]
17.3.1 - Defining the Destructor [Seite 376]
17.3.2 - When to Define a Copy Constructor [Seite 378]
17.3.3 - Implementing the Assignment Operator [Seite 378]
17.3.4 - Implementing Move Operations [Seite 380]
17.4 - Overloading the Arithmetic Operators [Seite 381]
17.4.1 - Improving Output Operations [Seite 385]
17.4.2 - Implementing One Operator in Terms of Another [Seite 387]
17.5 - Overloading the Subscript Operator [Seite 388]
17.5.1 - Lvalues and the Overloaded Subscript Operator [Seite 393]
17.5.1.1 - Potential Ambiguities with Conversions [Seite 396]
17.6 - Overloading Type Conversions [Seite 395]
17.7 - Overloading the Increment and Decrement Operators [Seite 396]
17.8 - Function Objects [Seite 397]
17.9 - Summary [Seite 398]
18 - Chapter 13: Inheritance [Seite 400]
18.1 - Classes and Object-Oriented Programming [Seite 400]
18.1.1 - Hierarchies [Seite 401]
18.2 - Inheritance in Classes [Seite 402]
18.2.1 - Inheritance vs. Aggregation [Seite 402]
18.2.2 - Deriving Classes [Seite 403]
18.3 - protected Members of a Class [Seite 406]
18.4 - The Access Level of Inherited Class Members [Seite 406]
18.4.1 - Choosing Access Specifiers in Class Hierarchies [Seite 408]
18.4.2 - Changing the Access Specification of Inherited Members [Seite 409]
18.5 - Constructor Operation in a Derived Class [Seite 410]
18.5.1 - The Copy Constructor in a Derived Class [Seite 413]
18.5.2 - The Default Constructor in a Derived Class [Seite 415]
18.5.3 - Inheriting Constructors [Seite 416]
18.6 - Destructors Under Inheritance [Seite 417]
18.6.1 - The Order in Which Destructors Are Called [Seite 418]
18.7 - Duplicate Data Member Names [Seite 419]
18.8 - Duplicate Function Member Names [Seite 420]
18.9 - Multiple Inheritance [Seite 420]
18.9.1 - Multiple Base Classes [Seite 421]
18.9.2 - Inherited Member Ambiguity [Seite 422]
18.9.3 - Repeated Inheritance [Seite 425]
18.9.4 - Virtual Base Classes [Seite 426]
18.10 - Converting Between Related Class Types [Seite 427]
18.11 - Summary [Seite 427]
19 - Chapter 14: Polymorphism [Seite 429]
19.1 - Understanding Polymorphism [Seite 429]
19.1.1 - Using a Base Class Pointer [Seite 429]
19.1.2 - Calling Inherited Functions [Seite 431]
19.1.3 - Virtual Functions [Seite 434]
19.1.3.1 - Requirements for Virtual Function Operation [Seite 438]
19.1.3.2 - Virtual Functions and Class Hierarchies [Seite 438]
19.1.3.3 - Using override [Seite 440]
19.1.3.4 - Using final [Seite 440]
19.1.3.5 - Access Specifiers and Virtual Functions [Seite 441]
19.1.4 - Default Argument Values in Virtual Functions [Seite 442]
19.1.5 - Virtual Function Calls with Smart Pointers [Seite 444]
19.1.6 - Using References to Call Virtual Functions [Seite 444]
19.1.7 - Calling the Base Class Version of a Virtual Function [Seite 445]
19.1.8 - Converting Between Pointers to Class Objects [Seite 446]
19.1.9 - Dynamic Casts [Seite 448]
19.1.9.1 - Casting Pointers Dynamically [Seite 448]
19.1.10 - Converting References [Seite 450]
19.1.11 - Determining the Polymorphic Type [Seite 450]
19.2 - The Cost of Polymorphism [Seite 451]
19.3 - Pure Virtual Functions [Seite 452]
19.3.1 - Abstract Classes [Seite 453]
19.3.1.1 - Abstract Classes As Interfaces [Seite 455]
19.3.2 - Indirect Abstract Base Classes [Seite 456]
19.4 - Destroying Objects Through a Pointer [Seite 458]
19.4.1 - Virtual Destructors [Seite 460]
19.5 - Summary [Seite 460]
20 - Chapter 15: Runtime Errors and Exceptions [Seite 462]
20.1 - Handling Errors [Seite 462]
20.2 - Understanding Exceptions [Seite 463]
20.2.1 - Throwing an Exception [Seite 464]
20.2.2 - The Exception Handling Process [Seite 466]
20.2.2.1 - Unhandled Exceptions [Seite 467]
20.2.3 - Code That Causes an Exception to Be Thrown [Seite 468]
20.2.4 - Nested try Blocks [Seite 470]
20.2.5 - How It Works [Seite 472]
20.3 - Class Objects as Exceptions [Seite 473]
20.3.1 - Matching a Catch Handler to an Exception [Seite 474]
20.3.2 - How It Works [Seite 476]
20.3.3 - Catching Derived Class Exceptions with a Base Class Handler [Seite 477]
20.3.4 - Rethrowing Exceptions [Seite 479]
20.3.5 - Catching All Exceptions [Seite 482]
20.4 - Functions That Throw Exceptions [Seite 484]
20.4.1 - Function try Blocks [Seite 484]
20.4.2 - Functions That Don't Throw Exceptions [Seite 485]
20.4.3 - Constructor try Blocks [Seite 485]
20.4.4 - Exceptions and Destructors [Seite 486]
20.5 - Standard Library Exceptions [Seite 486]
20.5.1 - The Exception Class Definitions [Seite 488]
20.5.2 - Using Standard Exceptions [Seite 489]
20.5.2.1 - Deriving your own Exception Classes [Seite 489]
20.6 - Summary [Seite 492]
21 - Chapter 16: Class Templates [Seite 494]
21.1 - Understanding Class Templates [Seite 494]
21.2 - Defining Class Templates [Seite 495]
21.2.1 - Template Parameters [Seite 496]
21.2.2 - A Simple Class Template [Seite 497]
21.2.3 - Defining Function Members of a Class Template [Seite 499]
21.2.3.1 - Constructor Templates [Seite 499]
21.2.3.2 - The Destructor Template [Seite 500]
21.2.3.3 - Subscript Operator Templates [Seite 501]
21.2.3.4 - The Assignment Operator Template [Seite 501]
21.3 - Instantiating a Class Template [Seite 502]
21.4 - Static Members of a Class Template [Seite 507]
21.5 - Non-Type Class Template Parameters [Seite 508]
21.5.1 - Templates for Function Members with Non-Type Parameters [Seite 511]
21.5.2 - Arguments for Non-Type Parameters [Seite 515]
21.5.3 - Pointers and Arrays as Non-Type Parameters [Seite 515]
21.6 - Default Values for Template Parameters [Seite 516]
21.7 - Explicit Template Instantiation [Seite 517]
21.8 - Special Cases [Seite 517]
21.8.1 - Using static_assert(?) in a Class Template [Seite 518]
21.8.2 - Defining a Class Template Specialization [Seite 519]
21.8.3 - Partial Template Specialization [Seite 520]
21.8.4 - Choosing between Multiple Partial Specializations [Seite 520]
21.9 - Friends of Class Templates [Seite 521]
21.10 - Class Templates with Nested Classes [Seite 523]
21.10.1 - Function Templates for Stack Members [Seite 525]
21.11 - Summary [Seite 529]
22 - Chapter 17: File Input and Output [Seite 531]
22.1 - Input and Output in C++ [Seite 531]
22.1.1 - Understanding Streams [Seite 532]
22.1.1.1 - Data Transfer Modes [Seite 532]
22.1.1.2 - Text Mode Operations [Seite 532]
22.1.1.3 - Binary Mode Operations [Seite 532]
22.1.2 - Advantages of Using Streams [Seite 533]
22.2 - Stream Classes [Seite 534]
22.2.1 - Standard Stream Objects [Seite 535]
22.2.2 - Stream Insertion and Extraction Operations [Seite 535]
22.2.2.1 - Stream Extraction Operations [Seite 536]
22.2.2.2 - Stream Insertion Operations [Seite 536]
22.2.3 - Stream Manipulators [Seite 537]
22.2.3.1 - Manipulators with Arguments [Seite 539]
22.3 - File Streams [Seite 540]
22.3.1 - Writing a File in Text Mode [Seite 541]
22.3.2 - Reading a File in Text Mode [Seite 543]
22.3.2.1 - Checking the State of a File Stream [Seite 543]
22.3.2.2 - Reading the File [Seite 544]
22.4 - Setting the Stream Open Mode [Seite 546]
22.4.1 - Managing the Current Stream Position [Seite 551]
22.5 - Unformatted Stream Operations [Seite 553]
22.5.1 - Unformatted Stream Input [Seite 554]
22.5.2 - Unformatted Stream Output [Seite 556]
22.6 - Errors in Stream Input/Output [Seite 556]
22.6.1 - Input/Output Errors and Exceptions [Seite 558]
22.7 - Stream Operations in Binary Mode [Seite 559]
22.7.1 - Writing Numeric Data in Binary [Seite 561]
22.8 - File Read/Write Operations [Seite 569]
22.8.1 - Random Access to a File [Seite 570]
22.8.1.1 - Random Access to a Binary Stream [Seite 570]
22.8.1.2 - Random File Operations in Practice [Seite 570]
22.8.1.2.1 - Implementing the Constructor [Seite 571]
22.8.1.2.2 - Checking for the Existence of a File [Seite 572]
22.8.1.2.3 - Finding a Prime that follows a Prime [Seite 573]
22.8.1.2.4 - Checking for a Prime [Seite 574]
22.8.1.2.5 - Implementing the Subscript Operator [Seite 574]
22.8.1.2.6 - Using the Primes Class [Seite 575]
22.9 - String Streams [Seite 576]
22.10 - Objects and Streams [Seite 577]
22.10.1 - Using the Insertion Operator with Objects [Seite 577]
22.10.2 - Using the Extraction Operator with Objects [Seite 578]
22.10.3 - Object I/O in Binary Mode [Seite 580]
22.10.4 - More Complex Objects in Streams [Seite 583]
22.11 - Summary [Seite 588]
23 - Index [Seite 590]
System requirements
File format: PDF
Copy protection: Watermark-DRM (Digital Rights Management)
System requirements:
- Computer (Windows; MacOS X; Linux): Use the free software Adobe Reader, Adobe Digital Editions, or any other PDF viewer of your choice (see eBook Help).
- Tablet/Smartphone (Android; iOS): Install the free app Adobe Digital Editions or another reading app for eBooks, e.g., PocketBook (see eBook Help).
- E-reader: Bookeen, Kobo, Pocketbook, Sony, Tolino and many more (only limited: Kindle).
The file format PDF always displays a book page identically on any hardware. This makes PDF suitable for complex layouts such as those used in textbooks and reference books (images, tables, columns, footnotes). Unfortunately, on the small screens of e-readers or smartphones, PDFs are rather annoying, requiring too much scrolling.
This eBook uses Watermark-DRM, a „soft” copy protection. This means that there are no technical restrictions to prevent illegal distribution. However, there is a personalised watermark embedded in the eBook that can be used to identify the purchaser of the eBook in the event of misuse and to provide evidence for legal purposes.
For more information, see our eBook Help page.