Free tutorial · 21 lessons

C++ Tutorial

Learn modern C++ (C++20) step by step: types, strings, control flow, functions, references, pointers, smart pointers, RAII, classes, inheritance, templates, the STL, ranges, exceptions, move semantics and threads — with outputs shown.

Start learning →

C++ Basics

  1. C++ Introduction — What C++ is, where it's used and a first program.
  2. C++ Get Started — Install a compiler, compile and run a program, and use CMake.
  3. C++ Syntax and Output — Statements, namespaces, comments, cout and std::format.
  4. C++ Variables and Data Types — Fundamental types, auto, const, constexpr and initialisation.
  5. C++ Strings — std::string operations, string_view and conversions.
  6. C++ Operators and Math — Arithmetic, comparison, logical operators and <cmath>.
  7. C++ History & Versions — How Bjarne Stroustrup turned "C with Classes" into C++, every ISO standard from C++98 to C++26 on one timeline, why C++11 is called "modern C++", and which standard to use today.

Control Flow and Functions

  1. C++ Conditions and Loops — if, switch, for, range-based for, while and do-while.
  2. C++ Functions — Declare functions, pass by value or reference, defaults, overloading and lambdas.

Memory and Pointers

  1. C++ References and Pointers — Addresses, pointers, references, nullptr and when to use each.
  2. C++ Smart Pointers and RAII — unique_ptr, shared_ptr, RAII and why you rarely write new/delete.

Object-Oriented C++

  1. C++ Classes and Objects — Classes, access specifiers, constructors, member functions and const.
  2. C++ Inheritance and Polymorphism — Base classes, virtual functions, override and abstract classes.
  3. C++ Templates — Function and class templates, and C++20 concepts.

Standard Library

  1. C++ Vector — std::vector: the default container — add, access, iterate and erase.
  2. C++ Maps and Sets — std::map, std::unordered_map, std::set and structured bindings.
  3. C++ Algorithms and Ranges — sort, find, accumulate, transform and C++20 ranges.

Advanced C++

  1. C++ Exceptions — throw, try, catch, standard exception types and noexcept.
  2. C++ Move Semantics — Copy vs move, std::move and the rule of zero.
  3. C++ Threads — std::thread, std::jthread, mutexes and std::async.

Next Steps

  1. C++ Next Steps — Build systems, tools, books and interview practice.