38,85 €*
Versandkostenfrei per Post / DHL
auf Lager, Lieferzeit 1-2 Werktage
Siddhartha Rao is the vice president in charge of product security at SAP SE, the world’s most trustworthy supplier of enterprise software and cloud services. A software engineer at heart, Siddhartha is convinced that the rapid evolution of C++ has powered this age of machine learning and artificial intelligence. Features introduced by C++20 enable you to program simpler yet more powerful applications than ever before. In authoring this book, Siddhartha has taken care to ensure that this book’s nearly 300 compiling code examples are accompanied by detailed analyses of how they work.
Siddhartha looks forward to your comments, reviews, and feedback!
Introduction xxvi
PART I: The Basics
Lesson 1: Getting Started
A Brief History of C++
Connection to C
Advantages of C++
Evolution of the C++ Standard
Who Uses Programs Written in C++?
Programming a C++ Application
Steps in Building an Executable
Analyzing Errors and Debugging
Integrated Development Environments
Programming Your First C++ Application
Building and Executing Your First C++ Application
Understanding Compiler Errors
What’s New in C++20?
Summary
Q&A
Workshop
Quiz
Exercises
Lesson 2: The Anatomy of a C++ Program
Parts of the Hello World Program
Preprocessor Directive #include
The Body of Your Program: main()
Returning a Value
The Concept of Namespaces
Comments in C++ Code
Functions in C++
Basic Input Using std::cin and Output Using std::cout
Summary
Q&A
Workshop
Quiz
Exercises
Lesson 3: Using Variables, Declaring Constants
What Is a Variable?
Memory and Addressing in Brief
Declaring Variables to Access and Use Memory
Declaring and Initializing Multiple Variables of a Type
Understanding the Scope of a Variable
Global Variables
Naming Conventions
Common Compiler-Supported C++ Variable Types
Using Type bool to Store Boolean Values
Using Type char to Store Character Values
The Concept of Signed and Unsigned Integers
Signed Integer Types short, int, long, and long long
Unsigned Integer Types unsigned short, unsigned int, unsigned long, and unsigned long long
Avoiding Overflow Errors by Selecting Correct Data Types
Floating-Point Types float and double
Determining the Size of a Variable by Using sizeof()
Avoid Narrowing Conversion Errors by Using List Initialization
Automatic Type Inference Using auto
Using typedef to Substitute a Variable’s Type
What Is a Constant?
Literal Constants
Declaring Variables as Constants Using const
Constant Expressions Using constexpr
C++20 Immediate Functions Using consteval
Enumerations
Scoped Enumerations
Defining Constants by Using #define
Keywords You Cannot Use as Variable or Constant Names
Summary
Q&A
Workshop
Quiz
Exercises
Lesson 4: Managing Arrays and Strings
What Is an Array?
The Need for Arrays
Declaring and Initializing Static Arrays
How Data Is Stored in an Array
Accessing Data Stored in an Array
Modifying Data Stored in an Array
Multidimensional Arrays
Declaring and Initializing Multidimensional Arrays
Accessing Elements in a Multidimensional Array
Dynamic Arrays
C-Style Character Strings
C++ Strings: Using std::string
Summary
Q&A
Workshop
Quiz
Exercises
Lesson 5: Working with Expressions, Statements, and Operators
Statements
Compound Statements, or Blocks
Using Operators
The Assignment Operator (=)
Understanding l-Values and r-Values
Operators to Add (+), Subtract (-), Multiply (*), Divide (/), and Modulo Divide (%)
Operators to Increment (++) and Decrement (--)
To Postfix or to Prefix?
Equality Operators (== and !=)
Relational Operators
C++20 Three-Way Comparison Operator (<=>)
Logical Operations NOT, AND, OR, and XOR
Using C++ Logical Operators NOT (!), AND (&&), and OR (||)
Bitwise NOT (~), AND (&), OR (|), and XOR (^) Operators
>>) and Left Shift (<<) Operators
Compound Assignment Operators
Using the sizeof() Operator to Determine the Memory Occupied by a Variable
Operator Precedence and Associativity
Summary
Q&A
Workshop
Quiz
Exercises
Lesson 6: Controlling Program Flow
Conditional Execution Using if.else
Conditional Programming Using if.else
Conditional Execution of Statements Within a Block
Nested if Statements
Conditional Processing Using switch-case
Conditional Execution Using the ?: Operator
Getting Code to Execute in Loops
A Rudimentary Loop Using goto
The while Loop
The do.while Loop
The for Loop
The Range-Based for Loop
Modifying Loop Behavior Using continue and break
Loops That Don’t End: Infinite Loops
Controlling Infinite Loops
Programming Nested Loops
Using Nested Loops to Walk a Multidimensional Array
Using Nested Loops to Calculate Fibonacci Numbers
Summary
Q&A
Workshop
Quiz
Exercises
Lesson 7: Organizing Code with Functions
The Need for Functions
What Is a Function Prototype?
What Is a Function Definition?
What Is a Function Call, and What Are Arguments?
Programming a Function with Multiple Parameters
Programming Functions with No Parameters or No Return Values
Function Parameters with Default Values
Recursion: Functions That Invoke Themselves
Functions with Multiple Return Statements
Using Functions to Work with Different Forms of Data
Overloading Functions
Passing an Array of Values to a Function
Passing Arguments by Reference
How Function Calls Are Handled by the Microprocessor
Inline Functions
Automatic Return Type Deduction
Lambda Functions
Summary
Q&A
Workshop
Quiz
Exercises
Lesson 8: Pointers and References Explained
What Is a Pointer?
Declaring a Pointer
Determining the Address of a Variable by Using the Reference Operator (&)
Using Pointers to Store Addresses
Accessing Pointed Data Using the Dereference Operator (*)
What Is the Size of a Pointer?
Dynamic Memory Allocation
Using the Operators new and delete to Allocate and Release
Memory Dynamically
Effects of the Increment (++) and Decrement (--) Operators on Pointers
Using the const Keyword on Pointers
Passing Pointers to Functions
Similarities Between Arrays and Pointers
Common Programming Mistakes When Using Pointers
Memory Leaks
Pointers Pointing to Invalid Memory Locations
Dangling Pointers (Also Called Stray or Wild Pointers)
Checking Whether an Allocation Request Using new Succeeded
Pointer Programming Best Practices
What Is a Reference?
What Makes References Useful?
Using the Keyword const on References
Passing Arguments by Reference to Functions
Summary
Q&A
Workshop
Quiz
Exercises
PART II: Fundamentals of Object-Oriented C++ Programming
Lesson 9: Classes and Objects
The Concept of Classes and Objects
Declaring a Class
An Object as an Instance of a Class
Accessing Members by Using the Dot Operator (.)
>)
The Keywords public and private
Abstraction of Data via the Keyword private
Constructors
Declaring and Implementing a Constructor
When and How to Use Constructors
Overloading Constructors
A Class Without a Default Constructor
Constructor Parameters with Default Values
Constructors with Initialization Lists
Destructor
Declaring and Implementing a Destructor
When and How to Use a Destructor
The Copy Constructor
Shallow Copying and Associated Problems
Ensuring a Deep Copy Using a Copy Constructor
Using Move Constructors to Improve Performance
Different Uses of Constructors and the Destructor
A Class That Does Not Permit Copying
A Singleton Class That Permits a Single Instance
A Class That Prohibits Instantiation on the Stack
Using Constructors to Convert Types
The this Pointer
Using sizeof() with a Class
The Keyword struct and Its Differences from class
Declaring a friend of a class
Union: A Special Data Storage Mechanism
Declaring a Union
Where Would You Use a Union?
Using Aggregate Initialization on Classes and structs
constexpr with Classes and Objects
Summary
Q&A
Workshop
Quiz
Exercises
Lesson 10: Implementing Inheritance
Basics of Inheritance
Inheritance and Derivation
C++ Syntax of Derivation
The Access Specifier Keyword protected
Base Class Initialization: Passing Parameters to the Base Class
A Derived Class Overriding the Base Class’s Methods
Invoking Overridden Methods of a Base Class
Invoking Methods of a Base Class in a Derived Class
A Derived Class Hiding the Base Class’s Methods
Order of Construction
Order of Destruction
Private Inheritance
Protected Inheritance
The Problem of Slicing
Multiple Inheritance
Avoiding Inheritance Using final
Summary
Q&A
Workshop
Quiz
Exercises
Lesson 11: Polymorphism
Basics of Polymorphism
Need for Polymorphic Behavior
Polymorphic Behavior Implemented Using Virtual Functions
Need for Virtual Destructors
How Do Virtual Functions Work? Understanding the Virtual Function Table
Abstract Base Classes and Pure Virtual Functions
Using Virtual Inheritance to Solve the Diamond Problem
Using the Specifier override to Indicate the Intention to Override
Using final to Prevent Function Overriding
Virtual Copy Constructors?
Summary
Q&A
Workshop
Quiz
Exercises
Lesson 12: Operator Types and Operator Overloading
What Are Operators in C++?
Unary Operators
Unary Increment (++) and Decrement (--) Operators
Conversion Operators
>)
Binary Operators
The Binary Addition (a+b) and Subtraction (a-b) Operators
The Addition Assignment (+=) and Subtraction Assignment (-=) Operators
The Equality (==) and Inequality (!=) Operators
The <, >, <=, and >= Operators
The C++20 Three-Way Comparison...
Erscheinungsjahr: | 2022 |
---|---|
Fachbereich: | Programmiersprachen |
Genre: | Informatik |
Rubrik: | Naturwissenschaften & Technik |
Medium: | Taschenbuch |
Reihe: | Sams Teach Yourself |
Inhalt: | Kartoniert / Broschiert |
ISBN-13: | 9780137334681 |
ISBN-10: | 0137334680 |
Sprache: | Englisch |
Einband: | Kartoniert / Broschiert |
Autor: | Rao, Siddhartha |
Auflage: | 9. Auflage |
Hersteller: | Pearson |
Maße: | 233 x 182 x 50 mm |
Von/Mit: | Siddhartha Rao |
Erscheinungsdatum: | 24.03.2022 |
Gewicht: | 1,431 kg |
Siddhartha Rao is the vice president in charge of product security at SAP SE, the world’s most trustworthy supplier of enterprise software and cloud services. A software engineer at heart, Siddhartha is convinced that the rapid evolution of C++ has powered this age of machine learning and artificial intelligence. Features introduced by C++20 enable you to program simpler yet more powerful applications than ever before. In authoring this book, Siddhartha has taken care to ensure that this book’s nearly 300 compiling code examples are accompanied by detailed analyses of how they work.
Siddhartha looks forward to your comments, reviews, and feedback!
Introduction xxvi
PART I: The Basics
Lesson 1: Getting Started
A Brief History of C++
Connection to C
Advantages of C++
Evolution of the C++ Standard
Who Uses Programs Written in C++?
Programming a C++ Application
Steps in Building an Executable
Analyzing Errors and Debugging
Integrated Development Environments
Programming Your First C++ Application
Building and Executing Your First C++ Application
Understanding Compiler Errors
What’s New in C++20?
Summary
Q&A
Workshop
Quiz
Exercises
Lesson 2: The Anatomy of a C++ Program
Parts of the Hello World Program
Preprocessor Directive #include
The Body of Your Program: main()
Returning a Value
The Concept of Namespaces
Comments in C++ Code
Functions in C++
Basic Input Using std::cin and Output Using std::cout
Summary
Q&A
Workshop
Quiz
Exercises
Lesson 3: Using Variables, Declaring Constants
What Is a Variable?
Memory and Addressing in Brief
Declaring Variables to Access and Use Memory
Declaring and Initializing Multiple Variables of a Type
Understanding the Scope of a Variable
Global Variables
Naming Conventions
Common Compiler-Supported C++ Variable Types
Using Type bool to Store Boolean Values
Using Type char to Store Character Values
The Concept of Signed and Unsigned Integers
Signed Integer Types short, int, long, and long long
Unsigned Integer Types unsigned short, unsigned int, unsigned long, and unsigned long long
Avoiding Overflow Errors by Selecting Correct Data Types
Floating-Point Types float and double
Determining the Size of a Variable by Using sizeof()
Avoid Narrowing Conversion Errors by Using List Initialization
Automatic Type Inference Using auto
Using typedef to Substitute a Variable’s Type
What Is a Constant?
Literal Constants
Declaring Variables as Constants Using const
Constant Expressions Using constexpr
C++20 Immediate Functions Using consteval
Enumerations
Scoped Enumerations
Defining Constants by Using #define
Keywords You Cannot Use as Variable or Constant Names
Summary
Q&A
Workshop
Quiz
Exercises
Lesson 4: Managing Arrays and Strings
What Is an Array?
The Need for Arrays
Declaring and Initializing Static Arrays
How Data Is Stored in an Array
Accessing Data Stored in an Array
Modifying Data Stored in an Array
Multidimensional Arrays
Declaring and Initializing Multidimensional Arrays
Accessing Elements in a Multidimensional Array
Dynamic Arrays
C-Style Character Strings
C++ Strings: Using std::string
Summary
Q&A
Workshop
Quiz
Exercises
Lesson 5: Working with Expressions, Statements, and Operators
Statements
Compound Statements, or Blocks
Using Operators
The Assignment Operator (=)
Understanding l-Values and r-Values
Operators to Add (+), Subtract (-), Multiply (*), Divide (/), and Modulo Divide (%)
Operators to Increment (++) and Decrement (--)
To Postfix or to Prefix?
Equality Operators (== and !=)
Relational Operators
C++20 Three-Way Comparison Operator (<=>)
Logical Operations NOT, AND, OR, and XOR
Using C++ Logical Operators NOT (!), AND (&&), and OR (||)
Bitwise NOT (~), AND (&), OR (|), and XOR (^) Operators
>>) and Left Shift (<<) Operators
Compound Assignment Operators
Using the sizeof() Operator to Determine the Memory Occupied by a Variable
Operator Precedence and Associativity
Summary
Q&A
Workshop
Quiz
Exercises
Lesson 6: Controlling Program Flow
Conditional Execution Using if.else
Conditional Programming Using if.else
Conditional Execution of Statements Within a Block
Nested if Statements
Conditional Processing Using switch-case
Conditional Execution Using the ?: Operator
Getting Code to Execute in Loops
A Rudimentary Loop Using goto
The while Loop
The do.while Loop
The for Loop
The Range-Based for Loop
Modifying Loop Behavior Using continue and break
Loops That Don’t End: Infinite Loops
Controlling Infinite Loops
Programming Nested Loops
Using Nested Loops to Walk a Multidimensional Array
Using Nested Loops to Calculate Fibonacci Numbers
Summary
Q&A
Workshop
Quiz
Exercises
Lesson 7: Organizing Code with Functions
The Need for Functions
What Is a Function Prototype?
What Is a Function Definition?
What Is a Function Call, and What Are Arguments?
Programming a Function with Multiple Parameters
Programming Functions with No Parameters or No Return Values
Function Parameters with Default Values
Recursion: Functions That Invoke Themselves
Functions with Multiple Return Statements
Using Functions to Work with Different Forms of Data
Overloading Functions
Passing an Array of Values to a Function
Passing Arguments by Reference
How Function Calls Are Handled by the Microprocessor
Inline Functions
Automatic Return Type Deduction
Lambda Functions
Summary
Q&A
Workshop
Quiz
Exercises
Lesson 8: Pointers and References Explained
What Is a Pointer?
Declaring a Pointer
Determining the Address of a Variable by Using the Reference Operator (&)
Using Pointers to Store Addresses
Accessing Pointed Data Using the Dereference Operator (*)
What Is the Size of a Pointer?
Dynamic Memory Allocation
Using the Operators new and delete to Allocate and Release
Memory Dynamically
Effects of the Increment (++) and Decrement (--) Operators on Pointers
Using the const Keyword on Pointers
Passing Pointers to Functions
Similarities Between Arrays and Pointers
Common Programming Mistakes When Using Pointers
Memory Leaks
Pointers Pointing to Invalid Memory Locations
Dangling Pointers (Also Called Stray or Wild Pointers)
Checking Whether an Allocation Request Using new Succeeded
Pointer Programming Best Practices
What Is a Reference?
What Makes References Useful?
Using the Keyword const on References
Passing Arguments by Reference to Functions
Summary
Q&A
Workshop
Quiz
Exercises
PART II: Fundamentals of Object-Oriented C++ Programming
Lesson 9: Classes and Objects
The Concept of Classes and Objects
Declaring a Class
An Object as an Instance of a Class
Accessing Members by Using the Dot Operator (.)
>)
The Keywords public and private
Abstraction of Data via the Keyword private
Constructors
Declaring and Implementing a Constructor
When and How to Use Constructors
Overloading Constructors
A Class Without a Default Constructor
Constructor Parameters with Default Values
Constructors with Initialization Lists
Destructor
Declaring and Implementing a Destructor
When and How to Use a Destructor
The Copy Constructor
Shallow Copying and Associated Problems
Ensuring a Deep Copy Using a Copy Constructor
Using Move Constructors to Improve Performance
Different Uses of Constructors and the Destructor
A Class That Does Not Permit Copying
A Singleton Class That Permits a Single Instance
A Class That Prohibits Instantiation on the Stack
Using Constructors to Convert Types
The this Pointer
Using sizeof() with a Class
The Keyword struct and Its Differences from class
Declaring a friend of a class
Union: A Special Data Storage Mechanism
Declaring a Union
Where Would You Use a Union?
Using Aggregate Initialization on Classes and structs
constexpr with Classes and Objects
Summary
Q&A
Workshop
Quiz
Exercises
Lesson 10: Implementing Inheritance
Basics of Inheritance
Inheritance and Derivation
C++ Syntax of Derivation
The Access Specifier Keyword protected
Base Class Initialization: Passing Parameters to the Base Class
A Derived Class Overriding the Base Class’s Methods
Invoking Overridden Methods of a Base Class
Invoking Methods of a Base Class in a Derived Class
A Derived Class Hiding the Base Class’s Methods
Order of Construction
Order of Destruction
Private Inheritance
Protected Inheritance
The Problem of Slicing
Multiple Inheritance
Avoiding Inheritance Using final
Summary
Q&A
Workshop
Quiz
Exercises
Lesson 11: Polymorphism
Basics of Polymorphism
Need for Polymorphic Behavior
Polymorphic Behavior Implemented Using Virtual Functions
Need for Virtual Destructors
How Do Virtual Functions Work? Understanding the Virtual Function Table
Abstract Base Classes and Pure Virtual Functions
Using Virtual Inheritance to Solve the Diamond Problem
Using the Specifier override to Indicate the Intention to Override
Using final to Prevent Function Overriding
Virtual Copy Constructors?
Summary
Q&A
Workshop
Quiz
Exercises
Lesson 12: Operator Types and Operator Overloading
What Are Operators in C++?
Unary Operators
Unary Increment (++) and Decrement (--) Operators
Conversion Operators
>)
Binary Operators
The Binary Addition (a+b) and Subtraction (a-b) Operators
The Addition Assignment (+=) and Subtraction Assignment (-=) Operators
The Equality (==) and Inequality (!=) Operators
The <, >, <=, and >= Operators
The C++20 Three-Way Comparison...
Erscheinungsjahr: | 2022 |
---|---|
Fachbereich: | Programmiersprachen |
Genre: | Informatik |
Rubrik: | Naturwissenschaften & Technik |
Medium: | Taschenbuch |
Reihe: | Sams Teach Yourself |
Inhalt: | Kartoniert / Broschiert |
ISBN-13: | 9780137334681 |
ISBN-10: | 0137334680 |
Sprache: | Englisch |
Einband: | Kartoniert / Broschiert |
Autor: | Rao, Siddhartha |
Auflage: | 9. Auflage |
Hersteller: | Pearson |
Maße: | 233 x 182 x 50 mm |
Von/Mit: | Siddhartha Rao |
Erscheinungsdatum: | 24.03.2022 |
Gewicht: | 1,431 kg |