C++ Fundamentals: Hit the ground running with C++, the language that supports tech giants globally

This document was uploaded by one of our users. The uploader already confirmed that they had the permission to publish it. If you are author/publisher or own the copyright of this documents, please report to us by using this DMCA report form.

Simply click on the Download Book button.

Yes, Book downloads on Ebookily are 100% Free.

Sometimes the book is free on Amazon As well, so go ahead and hit "Search on Amazon"

Write high-level abstractions while retaining full control of the hardware, performances, and maintainability.

Key Features

  • Transform your ideas into modern C++ code, with both C++11 and C++17
  • Explore best practices for creating high-performance solutions
  • Understand C++ basics and work with concrete real-world examples

Book Description

C++ Fundamentals begins by introducing you to the C++ compilation model and syntax. You will then study data types, variable declaration, scope, and control flow statements. With the help of this book, you'll be able to compile fully working C++ code and understand how variables, references, and pointers can be used to manipulate the state of the program. Next, you will explore functions and classes ― the features that C++ offers to organize a program ― and use them to solve more complex problems. You will also understand common pitfalls and modern best practices, especially the ones that diverge from the C++98 guidelines.

As you advance through the chapters, you'll study the advantages of generic programming and write your own templates to make generic algorithms that work with any type. This C++ book will guide you in fully exploiting standard containers and algorithms, understanding how to pick the appropriate one for each problem.

By the end of this book, you will not only be able to write efficient code but also be equipped to improve the readability, performance, and maintainability of your programs.

What you will learn

  • C++ compilation model
  • Apply best practices for writing functions and classes
  • Write safe, generic, and efficient code with templates
  • Explore the containers that the C++ standard offers
  • Discover the new features introduced with C++11, C++14, and C++17
  • Get to grips with the core language features of C++
  • Solve complex problems using object-oriented programming in C++

Who this book is for

If you're a developer looking to learn a new powerful language or are familiar with C++ but want to update your knowledge with modern paradigms of C++11, C++14, and C++17, this book is for you. To easily understand the concepts in the book, you must be familiar with the basics of programming.

Table of Contents

  1. Getting Started
  2. Functions
  3. Classes
  4. Generic Programming and Templates
  5. Standard Library Containers and Algorithms
  6. Object-Oriented Programming

Author(s): Antonio Mallia, Francesco Zoffoli
Edition: 1
Publisher: Packt Publishing
Year: 2019

Language: English
Commentary: Better bookmarks than 24F46B053C39594F811E89B5E17446D6
Pages: 350
City: Birmingham, UK
Tags: C++; C++11; C++14; C++17; C++ Programming Language; Modern C++; Object-Oriented Programming

Preface
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
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
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
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
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
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
Index
_3znysh7
_2et92p0
_tyjcwt
_1fob9te
_3znysh7
_b5dg8zbfyg6w
_cb9ikpad3noo
_nq5blm2st249
_2et92p0
_GoBack
_gjdgxs
_30j0zll
_1fob9te
_Hlk535181203
_gjdgxs
_5r8zxok5uj88
_hzomkbv2r2uu
_jrg9pkplnl95
_pv446ggcf719
_1evjpqmej691
_irgzv08lbzor
_fn4m84dnwrkn
_o3gr6d69dzeo
_p7mei1v9iot7
_123cfwoxnuz1
_ucjotkyvywg7
_nb7dnvagrywe
_1eatq8qi93ub
_20c3fdnqqse0
_8ncn7991lm3o
_rik3o15d6a2t
_Hlk1230877
_GoBack
_Hlk1074134
_num2ypz7h6g9
_GoBack
_gjdgxs
_tr0q47d2zgds
_ya4gi2k2npbu
_15gpe88lopjt
_jk9jr85tpi05
_9oynsgptilns
_gz47uyi5ua89
_nfwmfujo9vkq
_sasal0pj933r
_2d22oyi1zf2
_kw3u755dlcrf
_GoBack