Learn C++ – all lessons
18 lessons from beginner to advanced, building on each other and with code examples.
Hello World, main and #include
Structure of a C++ program, output with std::cout and the path from source code to program.
Variables, Types and const
Basic types, type inference with auto, safe initialization and constants.
Conditions: if, switch and Operators
Making decisions with if/else, switch, logical operators and the ternary operator.
Loops: for, range-for and while
Repeating code – over numbers and containers, with break and continue.
Functions, Overloading and Declarations
Defining functions, default arguments, overloading and multiple return values.
References, Pointers and const Correctness
Passing by value, by reference and by const reference, plus the basics of pointers.
std::string and std::vector
The two most important standard types: text and dynamic arrays.
Input, Files and Streams
Reading from the console, writing and reading files, splitting text with stringstream.
Classes, Constructors and Destructors
Your own types with data and behavior – including const methods and operators.
Inheritance, virtual and Polymorphism
Base classes, virtual methods, abstract classes and the slicing trap.
RAII and Smart Pointers
Managing resources safely with unique_ptr, shared_ptr and weak_ptr – without new and delete.
STL: Containers, Algorithms and Lambdas
map, set, sort, find, transform and lambdas – the toolbox of the standard library.
Error Handling: Exceptions and optional
try/catch, custom exception classes, noexcept and alternatives to exceptions.
Templates and Generic Programming
Function and class templates, variadic templates and fold expressions.
Move Semantics and the Rule of Zero/Five
Moving resources instead of copying, rvalue references and perfect forwarding.
Ranges and Concepts (C++20)
Readable data pipelines with views and templates with clear requirements.
Undefined Behavior and Typical Pitfalls
Dangling references, iterator invalidation, overflows – and how sanitizers find them.
Modern C++: optional, variant, string_view and constexpr
Expressive building blocks from C++17/20 for safer and faster code.