Book description
Cut through the noise and get real results with a step-by-step approach to learning C++ development
Key Features
- Ideal for the C++ beginner who is getting started for the first time
- A C++ tutorial with step-by-step exercises and activities that help build key skills
- Structured to let you progress at your own pace, on your own terms
- Use your physical print copy to redeem free access to the online interactive edition
Book Description
You already know you want to learn C++ development, and a smarter way to learn C++ 11 is to learn by doing. The C++ Workshop focuses on building up your practical skills so that you can develop high-performance software applications or even your own independent games with effective modern C++. You'll learn from real examples that lead to real results.
Throughout The C++ Workshop, you'll take an engaging step-by-step approach to understanding C++ code. You won't have to sit through any unnecessary theory. If you're short on time you can jump into a single exercise each day or spend an entire weekend learning about advanced object-oriented principles. It's your choice. Learning on your terms, you'll build up and reinforce key skills in a way that feels rewarding.
Every physical print copy of The C++ Workshop unlocks access to the interactive edition. With videos detailing all exercises and activities, you'll always have a guided solution. You can also benchmark yourself against assessments, track progress, and receive content updates. You'll even earn a secure credential that you can share and verify online upon completion. It's a premium learning experience that's included with your printed copy. To redeem, follow the instructions located at the start of your C++ book.
Fast-paced and direct, The C++ Workshop is the ideal companion for C++ beginners. You'll build and iterate on your code like a software developer, learning along the way. This process means that you'll find that your new skills stick, embedded as best practice. A solid foundation for the years ahead.
What you will learn
- Get to grips with fundamental concepts and conventions of C++ 11
- Learn about best practices for clean code and how to avoid common pitfalls
- Reuse and reduce common code using the C++ standard library
- Debug and compile logical errors and handle exceptions in your programs
Who this book is for
Our goal at Packt is to help you be successful, in whatever it is you choose to do. The C++ Workshop is an ideal C++ tutorial for the C++ beginner who is just getting started. Pick up a Workshop today, and let Packt help you develop skills that stick with you for life.
Table of contents
- Preface
- 1. Your First C++ Application
- 2. Control Flow
-
3. Built-In Data Types
- Introduction
- Data Types
-
Containers
- Arrays
- Initialization
- Accessing Elements
- Array Memory
- Exercise 14: Implementing Containers to Store Usernames
- Multidimensional Arrays
- Exercise 15: Using Multidimensional Arrays to Store More Data
- Vectors
- Accessing Elements
- Exercise 16: Looping over a Vector
- Initialization
- Modifying Elements
- Exercise 17: Modifying a Vector
- Classes/Structs
- Storage Lifetime
- Summary
- 4. Operators
-
5. Pointers and References
- Introduction
- Memory Addresses
-
References
- Exercise 32: References
- Exercise 33: Bad References
- Pointers and References as Function Arguments
- Exercise 34: Pointers as Function Arguments
- Pointers to Classes or Structs
- Exercise 35: Pointers to Class Instance
- References as Function Arguments
- Exercise 36: References as Function Arguments
- Activity 5: Using Pointers and References to Manipulate an Array of Strings
- Summary
-
6. Dynamic Variables
- Introduction
- Dynamic Variables
-
Seven Dynamic Variable Sins
- Exercise 41: Using a Dynamic Variable before Creating It
- Exercise 42: Using a Dynamic Variable after Deleting It
- Exercise 43: Not Deleting a Dynamic Variable
- Exercise 44: Overwriting a Pointer to a Dynamic Variable
- Exercise 45: Deleting a Dynamic Variable Twice
- Exercise 46: Deleting a Dynamic Array with delete instead of delete[]
- Exercise 47: Deleting a Dynamic Variable with delete[] instead of delete
- Dynamic Containers
- Summary
-
7. Ownership and Lifetime of Dynamic Variables
- Introduction
-
Smart Pointers — Automated Ownership of Dynamic Variables
- unique_ptr<>
- Exercise 52: Working with unique_ptr<>
- make_unique()
- Exercise 53: Using make_unique()
- unique_ptr<> as a Class Member Variable
- Exercise 54: Using unique_ptr<> as a Class Member Variable
- unique_ptr<> in Function Arguments and Return Values
- Exercise 55: Using unique_ptr<> in Function Return Values
- Shared Ownership of Dynamic Variables
- Summary
-
8. Classes and Structs
- Introduction
- Classes versus Structs
- Unions
-
Constructors and Destructors
- Constructors
- Default Constructors
- Exercise 58: Defining a Default Constructor
- Parameterized Constructors
- Exercise 59: Defining a Parameterized Constructor
- Copy Constructors
- Shallow Copy or Deep Copy
- Exercise 60: Defining a Copy Constructor
- Copy Assignment Operator
- Exercise 61: Overloading the Assignment Operator
- Destructors
- Activity 8: Creating a VideoClip Class
- Summary
- 9. Object-Oriented Principles
- 10. Advanced Object-Oriented Principles
-
11. Templates
- Introduction
- Syntax
- Creating a Generic Queue
- Summary
- 12. Containers and Iterators
-
13. Exception Handling in C++
- Introduction
-
Responding to Unexpected Events
- Throwing Exceptions
- Uncaught Exceptions
- Exercise 80: Throwing Uncaught Exceptions
- Catching Exceptions
- Exercise 81: try/catch Blocks
- Exercise 82: Exceptions Thrown by C++
- Unwinding the Stack
- RAII (Resource Acquisition Is Initialization) and Exception Handling
- Exercise 83: Unwinding the Stack
- Activity 13: Handling Exceptions
- Summary
-
Appendix
- 1. Your First C++ Application
- 2. Control Flow
- 3. Built-in Data Types
- 4. Operators
- 5. Pointers and References
- 6. Dynamic Variables
- 7. Ownership and Lifetime Of Dynamic Variables
- 8. Classes and Structs
- 9. Object-Oriented Principles
- 10. Advanced Object-Oriented Principles
- 11. Templates
- 12. Containers and Iterators
- 13. Exception Handling in C++
Product information
- Title: The C++ Workshop
- Author(s):
- Release date: February 2020
- Publisher(s): Packt Publishing
- ISBN: 9781839216626
You might also like
book
Exploring C++20: The Programmer's Introduction to C++
Discover everything you need to know about C++ in a logical progression of small lessons that …
video
C++ Programming By Example
C++ is a flexible and generic language that offers a wide range of benefits with key …
book
Beginning C++ Programming
Modern C++ at your fingertips! About This Book This book gets you started with the exciting …
video
Beginning C++ Programming
In this C++ for Beginners training course, expert author John Dubchak will teach you everything you …