售 价:¥
温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印
为你推荐
Preface
About the Book
About the Authors
Objectives
Audience
Approach
Minimum Hardware Requirements
Software Requirements
Additional Resources
Conventions
Chapter 1
Getting Started
Introduction
The C++ Compilation Model
Difference Between Header and Source Files
Compiling a File into an Object File
Linking Object Files
Working with the main Function
Exercise 1: Compiling and Executing the main Function
Built-in Data Types
Primitive Data Types
Datatype Modifiers
Variable Definition
Demystifying Variable Initialization
Pointers and References
Pointers
References
The const Qualifier
The Scope of Variables
Control Flow Statements
Selection Statement – if-else
Selection Statement – switch
Iteration Statement – for loop
Iteration Statement – while loop
Iteration Statement – do-while loop
Jump Statements – break and continue
The try-catch block
Exercise 2: Counting the Number of Times a Specific Number Appears in a Given List
Activity 1: Finding the Factors of 7 between 1 and 100 Using a while Loop
Arrays
Array Declaration
Array Initialization
Accessing the Values of an Array
Multidimensional Arrays
Activity 2: Defining a Bi-Dimensional Array and Initializing Its Elements
Summary
Chapter 2
Functions
Introduction
Function Declaration and Definition
Defining a Function
Exercise 3: Calling a Function from main()
Local and Global Variables
Working with Variable Objects
Exercise 4: Using Local and Global Variables in a Fibonacci Sequence
Passing Arguments and Returning Values
Pass by Value
Exercise 5: Calculating Age using Pass by Value Arguments
Pass by Reference
Exercise 6: Calculating Incrementation of Age using Pass by Reference
Activity 3: Checking Voting Eligibility
Working with const References or r-value References
Returning Values from Functions
Returning by Value
Returning by Reference
Activity 4: Using Pass by Reference and Pass by Value
Const Parameters and Default Arguments
Passing by const Value
Passing by const Reference
Returning by const Value
Returning by const Reference
Default Arguments
Namespaces
Activity 5: Organizing Functions in Namespaces
Function Overloading
Activity 6: Writing a Math Library for a 3D Game
Summary
Chapter 3
Classes
Introduction
Declaring and Defining a Class
The Advantages of Using Classes
C++ Data Members and Access Specifiers
Static Members
Exercise 7: Working with Static Variables
Member Functions
Declaring a Member Function
Using const Member Functions
The this Keyword
Exercise 8: Creating a Program Using the this Keyword to Greet New Users
Non-Member Class-Related Functions
Activity 7: Information Hiding Through Getters and Setters
Constructors and Destructors
Constructors
Overloading Constructor
Constructor Member Initialization
Aggregate Classes Initialization
Destructors
Exercise 9: Creating a Simple Coordinate Program to Demonstrate the Use of Constructors and Destructors
Default Constructor and Destructor
Activity 8: Representing Positions in a 2D Map
Resource Acquisition Is Initialization
Activity 9: Storing Multiple Coordinates of Different Positions on a Map
Nested Class Declarations
Friend Specifier
Friend Functions
Friend Classes
Exercise 10: Creating a Program to Print the User's Height
Activity 10: The AppleTree Class, which Creates an Apple Instance
Copy Constructors and Assignment Operators
The copy Assignment Operator
The move-constructor and move-assignment Operator
Preventing Implicit Constructors and Assignment Operators
Operator Overloading
Activity 11: Ordering Point Objects
Introducing Functors
Activity 12: Implementing Functors
Summary
Chapter 4
Generic Programming and Templates
Introduction
Templates
Compiling the Template Code
Exercise 11: Finding the Bank Account of the User with the Highest Balance
Using Template Type Parameters
Requirements of Template Parameter Types
Defining Function and Class Templates
Function Template
Class Templates
Dependent Types
Activity 13: Reading Objects from a Connection
Activity 14: Creating a User Account to Support Multiple Currencies
Non-Type Template Parameters
Activity 15: Writing a Matrix Class for Mathematical Operations in a Game
Making Templates Easier to Use
Default Template Arguments
Template Argument Deduction
Parameter and Argument Types
Activity 16: Making the Matrix Class Easier to Use
Being Generic in Templates
Activity 17: Ensuring Users are Logged in When Performing Actions on the Account
Variadic Templates
Activity 18: Safely Performing Operations on the User Cart with an Arbitrary Number of Parameters
Writing Easy-to-Read Templates
Type Alias
Template Type Alias
Summary
Chapter 5
Standard Library Containers and Algorithms
Introduction
Sequence Containers
Array
Vector
Deque
List
Forward-List
Providing Initial Values to Sequence Containers
Activity 19: Storing User Accounts
Associative Containers
Set and Multiset
Map and Multimap
Activity 20: Retrieving a User's Balance from their Given Username
Unordered Containers
Container Adaptors
Stack
Queue
Priority Queue
Activity 21: Processing User Registration in Order
Unconventional Containers
Strings
Exercise 12: Demonstrating Working Mechanism of the c_str() Function
Pairs and Tuples
std::optional
std::variant
Exercise 13: Using Variant in the Program
Exercise 14: Visitor Variant
Activity 22: Airport System Management
Iterators
Exercise 15: Exploring Iterator
Reverse Iterators
Exercise 16: Exploring Functions of Reverse Iterator
Insert Iterators
Stream Iterators
Exercise 17: Stream Iterator
Iterator Invalidation
Exercise 18: Printing All of the Customers' Balances
Algorithms Provided by the C++ Standard Template Library
Lambda
Read-Only Algorithms
Modifying Algorithms
Mutating Algorithms
Sorting Algorithms
Binary Search Algorithms
Numeric Algorithms
Exercise 19: Customer Analytics
Summary
Chapter 6
Object-Oriented Programming
Introduction
Inheritance
Exercise 20: Creating a Program to Illustrate Inheritance in C++
Exercise 21: Using Multiple Inheritance to Create a "Welcome to the Community" Message Application
Activity 23: Creating Game Characters
Polymorphism
Dynamic Binding
Virtual Methods
Exercise 22: Exploring the Virtual Method
Activity 24: Calculating Employee Salaries
Interfaces in C++
Activity 25: Retrieving User Information
Dynamic Memory
Safe and Easy Dynamic Memory
A Single Owner Using std::unique_ptr
Shared Ownership Using std::shared_ptr
Activity 26: Creating a Factory for UserProfileStorage
Activity 27: Using a Database Connection for Multiple Operations
Summary
Appendix
Lesson 1: Getting Started
Activity 1: Find the Factors of 7 between 1 and 100 Using a while Loop
Activity 2: Define a Bi-Dimensional Array and Initialize Its Elements
Lesson 2: Functions
Activity 3: Calculating if a Person is Eligible to Vote or Not
Activity 4: Apply the Understanding of Passing by Reference or Value in Functions
Activity 5: Organizing Functions in Namespaces
Activity 6: Writing a Math Library for use in a 3D Game
Lesson 3: Classes
Activity 7: Information Hiding Through Getters and Setters
Activity 8: Representing Positions in a 2D Map
Activity 9: Storing Multiple Coordinates of Different Positions in the Map
Activity 10: The AppleTree Class, which Creates an Apple Instance
Activity 11: Ordering Point Objects
Activity 12: Implementing Functors
Lesson 04: Generic Programming and Templates
Activity 13: Read Objects from a Connection
Activity 14: UserAccount to Support Multiple Currencies
Activity 15: Write a Matrix Class for Mathematical Operations in a Game
Solution bonus step:
Activity 16: Make the Matrix Class Easier to Use
Activity 17: Ensure Users are Logged in When Performing Actions on the Account
Activity 18: Safely Perform Operations on User Cart with an Arbitrary Number of Parameters
Lesson 5: Standard Library Containers and Algorithms
Activity 19: Storing User Accounts
Activity 20: Retrieving a User’s Balance from their Given Username
Activity 21: Processing User Registration in Order
Activity 22: Airport System Management
Lesson 6: Object-Oriented Programming
Activity 23: Creating Game Characters
Activity 24: Calculating Employee Salaries
Activity 25: Retrieving User Information
Activity 26: Creating a Factory for UserProfileStorage
Activity 27: Using a Database Connection for Multiple Operations
买过这本书的人还买过
读了这本书的人还在读
同类图书排行榜