C++

Paths

C++

Authors: Kate Gregory, Giovanni Dicanio, Dror Helper

C++ is an object-oriented programming language that was first developed by Bjarne Stroustrup. It was originally created to be an extension of the C language, which is a... Read more

What you will learn

  • Operators
  • Objects
  • Classes
  • Flow of control
  • References
  • Polymorphism and inheritance
  • C++ Type System
  • Heap/stack semantics
  • Stream I/O
  • Overloading
  • Lambdas
  • Exceptions
  • Scope management
  • Templates
  • C++ Standard Library
  • Concurrency

Pre-requisites

If you’re just learning to program you can get a gentle introduction with Learn How to Program with C++ . If you already know how to program and just want to learn C++, you can start with the C++ Fundamentals course.

Beginner

If you’re just learning to program you can get a gentle introduction with Learn How to Program with C++ . If you already know how to program and just want to learn C++, you can start with the C++ Fundamentals course. By the time you’ve completed these courses, you’ll be confident in writing basic applications and be familiar with the features offered in C++.

Learn How to Program with C++

by Kate Gregory

Jul 22, 2013 / 6h 57m

6h 57m

Start Course
Description

C++ has a reputation for being a very difficult language to learn, and to use well. Changes to the language and the library that accompanies it have changed that. Beginners can now learn C++ and write real applications. In this course you'll learn the important parts of C++ 11 syntax, get an introduction to the most useful parts of the Standard Library, and be challenged to write applications yourself in addition to watching someone else write and explain code.

Table of contents
  1. Getting Started
  2. Streams, Locals, and Flow of Control
  3. Functions and Headers
  4. Strings and Collections
  5. Writing Classes
  6. Compiler Specific Topics
  7. Topics to Learn Later
  8. Legacy Constructs

C++ Fundamentals Including C++ 17

by Kate Gregory

Mar 6, 2018 / 5h 47m

5h 47m

Start Course
Description

C++ is a general purpose programming language that is used by millions of developers. It has a reputation for being hard to learn and use, but with the changes in the language over the last few decades, this reputation is no longer deserved. C++ offers a powerful combination of performance and abstraction that other languages don’t have. In this course, C++ Fundamentals Including C++ 17, you'll learn how to write simple console applications and be ready to move on to writing platform-specific code. First, you’ll learn the basics of language syntax: declaring variables, classes, building expressions using operators and functions, working up to templates, indirection, and polymorphism. You'll explore the syntax additions from C++ 11, C++ 14, and C++17, using any modern compiler to run the examples. You'll also see the principles of Modern C++ in action, relying on the Standard Library and using idioms like Resource Acquisition is Initialization to reduce the effort involved in memory management. By the end of this course, you’ll be comfortable reading and writing Modern C++, including features added in C++17.

Table of contents
  1. Course Overview
  2. Understanding C++ in Context
  3. Tools
  4. Variables and Fundamental Types
  5. Language Basics - User Defined Types
  6. Language Basics – Flow of Control
  7. Language Basics - Functions
  8. Language Basics - Operators
  9. Templates
  10. Indirection
  11. Memory Management
  12. Indirection and Inheritance

Practical C++14 and C++17 Features

by Giovanni Dicanio

Dec 11, 2017 / 2h 32m

2h 32m

Start Course
Description

After the C++11 "revolution," several other features were added by the C++14 and C++17 standards. While C++11 was a massive improvement over the previous C++98/03, C++14 and C++17 are kind of more incremental improvements; nonetheless, interesting, powerful and useful features were added in these recent C++ standards. In this course, Practical C++14 and C++17 Features, you'll learn many practical features added in the C++14 and C++17 standards, assuming you have only a basic knowledge of C++11, like the one you can get watching the "C++11 from Scratch" course; any advanced C++11 concepts will be explained here on a need-to-know basis. Among the many topics discussed in this course, you'll start learning small but nice features, like digit separators. Then you'll explore more substantial features, like polymorphic lambdas (the course will also introduce basic lambdas as well, so you're not left in the dark if you don't know C++11 lambdas), and relaxed constexpr functions. You'll also learn about improvements to the C++ standard library, like the new standard-defined suffixes for the Chrono library (which will be introduced as well), or std::make_unique in combination with the unique_ptr smart pointer (that'll be introduced here as well). Finally, you'll explore new practical C++17 features, ranging from nested namespaces, to "constexpr if" and structured bindings. The features will be discussed using both slides, and with concrete C++ demo code, including showing some subtle bugs, and how to fix them. After completing this course, you'll be able to write simpler, clearer, more efficient and higher-quality modern C++ code, applying the features discussed in this course in your own C++ codebases. This course targets developers who are already familiar with basic C++11, and want to extend their knowledge to practical C++ features introduced in C++14 and in C++17. If you need a beginner-oriented introduction to C++11, you can watch the "C++11 from Scratch" course.

Table of contents
  1. Course Overview
  2. Convenient Syntactic Sugar
  3. Miscellaneous Improvements to C++11
  4. Standard Library Improvements
  5. Better Lambdas
  6. Practical Convenient C++17 Language Improvements

Intermediate

These intermediate courses will take you on a deep-dive in designing beautiful and functional C++ code. You’ll learn how to write efficient and modern C++ using data structures and algorithms and the C++ standard library.

C++ 17: Beyond the Basics

by Kate Gregory

Nov 26, 2019 / 2h 51m

2h 51m

Start Course
Description

Do you want to take your C++ skills from basic syntax to the next level, including libraries and modern C++? In this course, C++ 17: Beyond the Basics, you'll learn what modern C++ is, and why it's to your advantage to write that way. First, you'll learn about the Standard Library collection classes, and some of the functions in the algorithm header that will save you time and effort while making your code easier for others to understand. Next, you'll discover lambdas and how to use them, and how to take advantage of move semantics for a tremendous performance enhancement. Finally, you'll see what exceptions are, when to use them and when not to use them, and how they work. By the end of this course, you'll have built a fundamental knowledge of C++ syntax, fill in the gaps most C++ developers have, and become one of those developers who uses the whole language to get the most performance while still writing code that's easy to maintain and read.

Table of contents
  1. Course Overview
  2. Modern C++
  3. Standard Library Containers
  4. Lambdas
  5. Standard Library Algorithms
  6. Move Semantics
  7. Exceptions

Reading Legacy C++

by Kate Gregory

Feb 10, 2020 / 59m

59m

Start Course
Description

Because C++ has existed for decades, there is a lot of old code out there written with keywords, library functions, and practices that are just not used in modern C++. In this course, Reading Legacy C++, you will gain the ability to read and understand that old code. First, you will learn to read code that works with C-style arrays and C-style strings. Next, you will discover macros, typedefs, and some other old constructs. Finally, you will explore how to read and understand calls to printf, including format strings. When you are finished with this course, you will have the skills and knowledge of legacy C++ needed to understand and maintain this old code.

Table of contents
  1. Course Overview
  2. Arrays, Pointer Arithmetic, and Strings
  3. Macros, Old Keywords, More Pointers, and Printf

Introduction to Data Structures and Algorithms in C++

by Giovanni Dicanio

Oct 8, 2018 / 3h 29m

3h 29m

Start Course
Description

Knowing some fundamental data structures and algorithms both in theory and from a practical implementation perspective helps you in being a better C++ programmer, gives you a good foundation to understand standard library’s containers and algorithms inner “under the hood” mechanics, and serves as a kind of knowledge that is required in several coding interviews, as well.

In this course, Introduction to Data Structures and Algorithms in C++, you’ll learn how to implement some fundamental data structures and algorithms in C++ from scratch, with a combination of theoretical introduction using slides, and practical C++ implementation code as well.

No prior data structure or algorithm theory knowledge is required. You only need a basic knowledge of C++ language features.

  • First, you'll discover how to develop a C++ class to safely use arrays, with automatic memory management using constructor and destructor, and safely accessing array elements with bounds checking.
  • Then, you’ll see how to further improve this array class, overloading the insertion operator to offer a simple nice idiomatic printing syntax for arrays, and optimizing the array class with move semantics.
  • You’ll also learn how to properly copy arrays, and you’ll see the copy-and-swap idiom in action.
  • Then, you’ll learn how to generalize the array class with templates.
  • Next, you’ll learn about the Big O notation in a practical intuitive way, and you’ll apply that knowledge to a couple of search algorithms.
  • You’ll start learning how to search using the simple linear search, and then you’ll see how to improve searching, using binary search. I’ll first introduce these algorithms using slides, and then you’ll see them in action in concrete C++ demo code.
  • Finally, you’ll discover how to implement other common data structures, like the stack with its LIFO policy and push and pop operations, and linked lists, including operations like list node insertion and removal, and searching elements in a linked list.
After completing this course, you will be able to implement some common fundamental data structures and algorithms from scratch in C++, you’ll have a practical understanding of the Big O notation to evaluate and compare algorithm performance trends, and you’ll see in action, several interesting C++ coding techniques that you’ll be able to reuse in your own C++ projects as well.

Moreover, you will be able to use this foundational knowledge to move forward to more advanced C++ data structures and algorithms topics.

Table of contents
  1. Course Overview
  2. Safely Using Arrays
  3. Improve Array Implementation
  4. Efficiently Searching
  5. Implementing a Last-in First-out Pattern with the Stack
  6. Introducing Node-based Data Structures: Linked-lists

C++ Standard Library: Sequential Containers

by Giovanni Dicanio

Oct 1, 2019 / 2h 25m

2h 25m

Start Course
Description

Non-trivial computer programs need to store data and process it. Developing data structures and containers from scratch in C++ is a daunting and bug-prone task. In fact, you would have to consider advanced aspects like manual memory and resource management, proper handling subtle corner cases, writing both generic code and code that is optimized for special cases, and so on. Thankfully, the C++ Standard Library already offers containers that are high-quality, efficient and well-tested. It’s a joy to develop C++ code reusing them: In fact, using these containers in your C++ code, will boost your productivity, as the C++ Standard Library gives you on a platter high-quality implementations of common and useful data structures, that you can easily leverage in your C++ code. C++ Standard Library’s maintainers spend hours looking at these data structures, and improving, refining, and optimizing their C++ implementation code. In this course, you’ll learn how to simply reuse that treasure in your own C++ applications.

In particular, you’ll learn about std::vector, which is a flexible dynamic array, that should be the default container of choice in many contexts in C++ applications. You’ll enjoy the automatic resource management (for both memory resources and non-memory ones) offered by std::vector, which will help you develop both efficient and safer C++ code. You’ll also see how convenient is for example to grow a vector, still keeping the contiguous memory layout requirement for its elements.

You’ll also learn about important operations, like inserting, removing and searching elements, using both C++ container methods and Standard Library’s algorithms. In fact, C++ standard containers and algorithms are kind of like “bread and butter”, and you can do great things using both. You don’t need to have any previous experience with the C++ Standard Library, as I’ll teach you its great and flexible design based on containers, algorithms and iterators, and you’ll see how containers are wired with algorithms using iterators, and how you can reuse the same algorithms with different containers.

You’ll also learn that in some specific cases you can use a zero-overhead standard container that wraps fixed-size C-style arrays in a convenient high-level safe C++ interface: it’s std::array. I’ll compare and contrast it against std::vector, and you’ll learn pros and cons of each one.

You’ll also learn how to use the std::list container, if you need a high-level C++ abstraction based on the doubly-linked list data structure. Moreover, seeing the same algorithms used with different containers will also work very well as a reinforcement learning experience for you. I’ll also show you some subtle bugs, that are especially frequent in those starting learning the C++ Standard Library’s containers, and how to fix them. I hope this will save you time and headache during your C++ programming.

To proficiently follow this course, you only need a basic knowledge of C++ language features.

After completing this course, you will be able to use high-quality efficient and well-tested C++ Standard Library containers like std::vector, std::array and std::list in your own C++ code. You’ll have practical knowledge about them, and you’ll be able to make proper judgement about picking one or the other based on the problem at hand. You’ll also have knowledge about important common operations with these standard containers, like inserting, removing and searching items.

Table of contents
  1. Course Overview
  2. Storing Sequences of Elements with the Standard std::vector Container
  3. Breaking the Ice with Useful Standard Algorithms: Sorting std::vector
  4. Inserting, Removing, and Searching Elements
  5. Safely Encapsulating Fixed-size Arrays with std::array
  6. Managing Linked-lists with std::list

C++ Standard Library: Associative Containers

by Giovanni Dicanio

Mar 12, 2020 / 1h 28m

1h 28m

Start Course
Description

Non-trivial computer programs need to store data and process it. Developing data structures and containers from scratch in C++ is a daunting and bug-prone task. In fact, you would have to consider advanced aspects like manual memory and resource management, proper handling subtle corner cases, writing both generic code and code that is optimized for special cases, and so on. Moreover, there are some data structures like balanced binary search trees or hash tables that are very useful in applications; however, it is definitely non-trivial to implement from scratch.
Thankfully, the C++ Standard Library already offers containers that are high-quality, efficient, and well-tested. It’s a joy to develop C++ code reusing them: in fact, using these containers in your C++ code will boost your productivity, as the C++ Standard Library gives you on a platter high-quality implementations of common and useful data structures that you can easily leverage in your C++ code. C++ Standard Library’s maintainers spend hours looking at these data structures, and improving, refining, and optimizing their C++ implementation code. In this course, C++ Standard Library: Associative Containers, you will learn how to simply reuse that treasure in your own C++ applications.
First, you will explore std::map, which isa very versatile and convenient associative container that you can use when you need to associate some unique keys to additional values. This can come in handy in lots of applications, from translation dictionaries, to computer graphics programs to databases.
Next, you will discover important operations, like inserting, removing, and searching elements. You will first see them described in theory using slides, including a discussion of their asymptotic runtime complexity. Then, you’ll also see them in action in practical demo code. You will also touch on how to achieve even better performance than std::map, using std::unordered_map. You’ll see how that comes at a cost, though, like losing element ordering that is guaranteed by std::map. Then, you will see a practical demo code with a benchmark comparing std::unordered_map vs. std::map performance in action.
Finally, you will learn how to easily store unique elements in a specific container, maintaining element ordering. This is possible using std::set. You will see how to store custom objects in std::set, including how to fix a subtle bug. I hope that discussing subtle bugs that are especially frequent for those starting to learn the C++ Standard Library containers will save you precious time and headache during your C++ programming. To proficiently follow this course, you only need a basic knowledge of C++ language features. You also need to know some basic architectural elements ofthe C++ Standard Library, like iterators, that are described in my “C++ Standard Library: Sequential Containers” course.
After completing this course, you will be able to use high-quality efficient and well-tested C++ Standard Library associative containers like std::map, std::unordered_map and std::set in your own C++ code. You will have practical knowledge about them, and be able to make proper judgement about picking one or the other based on the problem at hand. You will also have knowledge about important common operations with these standard associative containers such as inserting, removing, and searching elements.

Table of contents
  1. Course Overview
  2. Storing Unique Objects with std::set
  3. Mapping Unique Keys to Values with std::map
  4. Efficient Key-value Associations with std::unordered_map

Beautiful C++: STL Algorithms

by Pluralsight

Jun 30, 2016 / 4h 24m

4h 24m

Start Course
Description

If you're a C++ developer, save yourself valuable time and work by learning how to use the algorithm header. In this course, Beautiful C++: STL Algorithms, you'll learn the functions in the algorithm header. You'll find out how iterators multiply the power of the library. Next, you'll learn the conventions that lower your mental burden. Finally, you'll learn how to use the same algorithm with different collections so you don't have to learn new functions. After this course, you'll know what the algorithm header has to offer you and how to use it to your advantage while developing.

Table of contents
  1. Course Overview
  2. Standard Library Philosophy and Approach
  3. Counting and Finding
  4. Sorting
  5. Comparing and Accumulating
  6. Generating and Manipulating Collections
  7. Using the Power of Iterators
  8. Unexpectedly Useful Operations
  9. Conventions

Beautiful C++: Updating Legacy Code

by Kate Gregory

Nov 19, 2018 / 5h 1m

5h 1m

Start Course
Description

C++ has been a popular programming language for decades, which means there’s some really old code out there. Some of it is very hard to read and maintain. Capabilities have been added to the language and standard library that could simplify this code, and possibly make it faster or eliminate nagging intermittent bugs. In this course, Beautiful C++: Updating Legacy Code, you’ll learn how to approach a large and unfamiliar codebase and make changes to modernize code. First, you'll learn some strategies for deciding exactly what to change. Then, you'll be introduced to language features and library capabilities that may not have existed when your code was first written, and can make it better now. Finally, you'll discover how to evaluate your progress and spread your gains through the rest of the code. By the end of this course, you'll be prepared for your code to last another generation or two and take full advantage of what modern C++ has to offer.

Table of contents
  1. Course Overview
  2. What Target Are You Trying to Reach?
  3. The Big Picture
  4. The Compiler Is Your Friend
  5. Use C++ as C++
  6. Language Changes in C++ 11, 14, and 17
  7. The Standard Library Will Save You Time and Trouble
  8. Reorganizing for Transparency
  9. When Are You Done?

Advanced

Refine your C++ skills even further by learning how to write unit tests for your C++ code. Then expand your toolkit by learning to write high performance and concurrent C++ code.

C++ Unit Testing Fundamentals Using Catch2

by Dror Helper

Jan 17, 2020 / 2h 1m

2h 1m

Start Course
Description

Writing unit tests is a big part of being a good software developer. Unfortunately, unit testing in C++ is far from being trivial, and good unit testing frameworks are hard to find. In this course, C++ Unit Testing Fundamentals Using Catch2, you will learn how to write robust unit tests using Catch2, a simple-to-use yet flexible and powerful unit testing framework for C++. You will learn what makes Catch2 different from other xUnit frameworks, and how it can be used to write unit tests for your C++ code. You will also get to see how to run Catch2 from the command line, how to use test fixtures, and how to create maintainable tests. When you're finished with this course, you will have a foundational knowledge of Catch2 and unit testing in C++ that would help you create better, cleaner C++ code.

Table of contents
  1. Course Overview
  2. Introducing Catch
  3. Organizing Your Tests Using Catch
  4. Asserting Using Catch
  5. Handling Duplicate Code

Advanced C++ Mocking Using Google Mock

by Dror Helper

May 19, 2017 / 3h 48m

3h 48m

Start Course
Description

Writing unit tests looks simple in blogs, books, and tutorials. However, it can be quite difficult when attempted in the real world where real code has dependencies that make unit testing difficult. The solution is to isolate unit tests using mocks, stubs, and fakes. Using mocks is crucial for any developer who attempts to unit test his code. In this course, Advanced C++ Mocking Using Google Mock, you'll learn how to fake dependencies in C++ using Google Mock. First, you'll learn about how to make unit tests simpler and more predictable using mocks. Next, you'll explore how to run Google Mock with different unit testing frameworks, and cover mocking frameworks best practices. Finally, you'll learn useful unit testing patterns for existing legacy code. By the end of this course, you'll have a working knowledge of mocking frameworks and Google Mock, and you'll be able to efficiently unit test any code.

Table of contents
  1. Course Overview
  2. Getting Started
  3. Unit Testing with Google Test
  4. Creating Fake Objects
  5. Setting Fake Object's Behavior
  6. Verifying Behavior
  7. Using Arguments and Matchers
  8. Getting Your Legacy Code Under Control

High-performance Computing in C++

by Pluralsight

Sep 17, 2015 / 4h 4m

4h 4m

Start Course
Description

Do you want to get the absolute most performance out of your hardware? Want to write code that scales across CPU registers, multi-core, and machine clusters? Then this is the course for you!

Table of contents
  1. Single Instruction Multiple Data (SIMD)
  2. Open Multi-Processing (OpenMP)
  3. Message Passing Interface (MPI)
  4. C++ Accelerated Massive Parallelism (C++ AMP)
  5. Generative Art Demo
Offer Code *
Email * First name * Last name *
Company
Title
Phone
Country *

* Required field

Opt in for the latest promotions and events. You may unsubscribe at any time. Privacy Policy

By providing my phone number to Pluralsight and toggling this feature on, I agree and acknowledge that Pluralsight may use that number to contact me for marketing purposes, including using autodialed or pre-recorded calls and text messages. I understand that consent is not required as a condition of purchase from Pluralsight.

By activating this benefit, you agree to abide by Pluralsight's terms of use and privacy policy.

I agree, activate benefit