C++ Course
C++ powers game engines, browsers, databases, finance systems and much of the software where speed matters. This course teaches modern C++ — C++20, with the newest C++23 additions — from your first program through containers, algorithms, classes, templates and concepts to multi-file projects, finishing with a complete library-catalogue application. It focuses on the safe, expressive style professionals use today: values, RAII, smart pointers and the standard library.
What you'll learn
The course has 53 lessons in ten parts:
- Getting Started — what C++ is, installing a compiler, and your first program.
- Basics — types,
auto, constants andconstexpr, operators, streams,std::string, conversions, conditions and loops. - Functions — references, choosing how to pass arguments, move semantics, overloading and namespaces.
- Containers —
std::array,std::vector,string_viewandspan, structs andenum class, maps, sets, queues and iterators. - Algorithms & Lambdas — lambdas, the standard algorithms, and C++20 ranges and views.
- Memory & Resources — pointers,
new/deleteand why to avoid them, smart pointers and RAII. - Object-Oriented Programming — classes, constructors, operator overloading, copy and move, inheritance, polymorphism and interfaces.
- Templates — function and class templates, and constraining them with concepts.
- Errors & the Standard Library — exceptions,
optional/variant/expected, files,std::format, random numbers, dates and threads. - Projects & Modern C++ — headers, CMake, C++23, safety and sanitizers, testing, and a final project.
Every example in the course was compiled with Clang using -std=c++20 -Wall -Wextra -pedantic (and -std=c++23 where marked) and run, and the output shown is exactly what it printed. Examples compile without warnings, except where a lesson shows a warning or error on purpose. The Try it yourself editors let you change any example and copy it to compile on your own computer.
No previous experience with C++ is required. Some programming experience — in any language, or our C course — makes the early lessons quicker.
Practice
- Playground — a starter program to copy and experiment with.
- Exercises — fill-in-the-blank tasks and programming challenges with solutions.
- Quiz — test your understanding across the whole course.
- Syllabus & Study Plan — learning outcomes and a week-by-week schedule.
Lessons
Getting Started
Basics
- Variables and Types
- Constants and constexpr
- Operators
- Input and Output with Streams
- Strings
- Type Conversions
- Conditions: if and switch
- Loops
Functions
- Functions
- References
- Passing Arguments: Value, Reference and Move
- Overloading and Default Arguments
- Scope, Lifetime and Namespaces
Containers
- Arrays and std::array
- Vectors
- string_view and span
- Structs and Enumerations
- Maps and Sets
- Stacks, Queues and Other Containers
- Iterators
Algorithms & Lambdas
Memory & Resources
- Pointers
- Dynamic Memory: new and delete
- Smart Pointers
- RAII: Resources That Clean Up After Themselves
Object-Oriented Programming
- Classes and Objects
- Constructors and Destructors
- Static Members and Friends
- Operator Overloading
- Copying and Moving Objects
- Inheritance
- Virtual Functions and Polymorphism
- Abstract Classes and Interfaces
Templates
Errors & the Standard Library
- Exceptions
- optional, variant and expected
- Files and Streams
- Formatting Text with std::format
- Random Numbers, Dates and Times
- Threads and Concurrency
Projects & Modern C++
- Headers and Multiple Source Files
- Building with CMake
- What's New in C++23
- Undefined Behaviour and Memory Safety
- Debugging, Testing and Best Practices
- Project: A Library Catalogue