Skip to content

Complete C++ Programming Study Guide

C++ is one of the most powerful and complex programming languages in existence. It gives you direct control over memory, performance, and hardware — but that power comes with a steep learning curve. This hub page maps every resource on this site and provides a learning path so you can build competence systematically.

These notes cover modern C++ (C++20/23) — the version of the language used in production today. Every concept includes worked code examples, common pitfalls, and the best practices that experienced developers rely on. The goal is not just to write code that compiles, but to write code that is correct, maintainable, and performant.


C++ topics are deeply interconnected. The following path reflects the dependencies — study the listed prerequisites before moving on.

Start here. These topics form the basis of every C++ program you will write.

  1. Types — data layout, pointers, references, and initialization
  2. Resource Management — ownership, RAII, and move semantics

Learn to build abstractions that hide complexity and express intent.

  1. Object-Oriented Programming — class design, polymorphism, and vtables
  2. Function Architecture — overload resolution, lambdas, and error handling

Phase 3: Generic Programming (Weeks 9–12)

Section titled “Phase 3: Generic Programming (Weeks 9–12)”

Write code that works across types while remaining type-safe.

  1. Templates and Metaprogramming — generic programming, concepts, and compile-time computation
  2. Standard Library — containers, algorithms, ranges, and I/O

Master the topics that distinguish professional C++ developers.

  1. Concurrency — threads, atomics, coroutines, and the memory model
Types
└── Resource Management (RAII, move semantics)
├── Object-Oriented Programming (class design, polymorphism)
│ └── Function Architecture (lambdas, type erasure)
├── Templates and Metaprogramming (generic programming)
│ └── Standard Library (containers, algorithms)
└── Concurrency (threads, atomics)

C++ is a statically typed language — understanding how types work at the memory level is essential for writing correct, performant code. This section covers data layout, pointers, references, and the rules that govern object lifetime.

Every C++ bug ultimately traces back to incorrect type usage or violated lifetime assumptions. Understanding data layout prevents buffer overflows. Understanding initialization prevents undefined behaviour. Understanding references versus pointers prevents dangling references.

ConceptWhat It MeansCommon Mistake
AlignmentObjects must start at addresses that are multiples of their alignmentAssuming sizeof(struct) is the sum of member sizes
PaddingCompilers insert bytes to satisfy alignment requirementsIgnoring padding when calculating memory usage
Value initializationT{} zero-initialises; T() default-initialisesAssuming T x; is the same as T x{};
LifetimeObjects begin existing when construction completes and end when destruction beginsAccessing an object after its destructor runs

C++ avoids garbage collection in favour of RAII (Resource Acquisition Is Initialization) — resources are tied to object lifetimes. This section covers ownership, smart pointers, move semantics, and the value category system that makes zero-cost abstractions possible.

Memory management is the number one source of bugs in C++. RAII eliminates entire categories of resource leaks. Move semantics make zero-cost abstractions possible — you can return large objects from functions without copying them.

// RAII: resource is released when the object goes out of scope
{
auto file = std::ifstream("data.txt"); // file opens here
// ... use file ...
} // file closes here automatically
// Move semantics: transfer ownership without copying
std::vector<int> create_data() {
std::vector<int> result = {1, 2, 3, 4, 5};
return result; // move or RVO — no copy
}

C++ supports multiple inheritance, virtual dispatch, and RTTI — powerful features that are easy to misuse. This section covers class design, polymorphism, and the implementation details (vtables, dynamic_cast) that determine performance and correctness.

PrincipleRuleExample
Rule of FiveIf you define any of destructor, copy/move constructor, or copy/move assignment, define all fiveRAII classes with raw pointers
Rule of ZeroIf possible, let the compiler generate all special member functionsUse std::string, std::vector instead of raw arrays
Prefer compositionUse inheritance only for “is-a” relationshipsA Dog is-an Animal; a Car has-an Engine
Avoid public data membersEncapsulate invariantsUse getters/setters or public interface

Templates are C++‘s mechanism for generic programming — writing code that works across types while remaining type-safe. Modern C++ (C++20) adds concepts, ranges, and compile-time computation.


The C++ standard library provides containers, algorithms, iterators, and utilities that form the backbone of idiomatic C++. Modern C++ (C++20) adds ranges, concepts, and parallel algorithms.


C++ concurrency covers threads, synchronisation primitives, the memory model, atomic operations, and coroutines. Writing correct concurrent code requires understanding both the hardware (cache coherency, memory ordering) and the language guarantees.


Functions are the building blocks of C++ programs. This section covers overload resolution, calling conventions, lambdas, type erasure, error handling, and C interop — the design decisions that determine how your code is structured and how it behaves.


Programming connects to theory and applied fields:

  • University Mathematics — linear algebra, discrete mathematics, and probability theory underpin algorithms and computational geometry
  • University Physics — computational physics, numerical methods, and simulation require C++ skills
  • IB Computer Science — introductory programming concepts at the IB level
  • DSE ICT — secondary-level computing for the Hong Kong DSE

C++ is a large language. Most developers become productive in 3–6 months and proficient in 2–3 years. These notes are designed for university-level students with some prior programming experience. If you are completely new to programming, start with a simpler language (Python, JavaScript) before tackling C++.

These notes cover C++20 and C++23 — the current standard. Use a recent compiler (GCC 13+, Clang 17+, MSVC 19.38+) to access modern features like concepts, ranges, coroutines, and std::format.

No. Modern C++ is a different language from C, and learning C habits first can make C++ harder to learn. Start with modern C++ idioms: RAII, smart pointers, containers, algorithms, and lambdas.

Start with the compiler’s warnings — enable -Wall -Wextra -Wpedantic and treat warnings as errors. Use AddressSanitizer (-fsanitize=address) to catch memory errors. For undefined behaviour, use UndefinedBehaviorSanitizer. For performance, use Valgrind or perf.

RAII (Resource Acquisition Is Initialization). If you understand RAII — that resource lifetimes are tied to object lifetimes — you will avoid most common C++ bugs: memory leaks, dangling pointers, and resource handles left open.

Yes. Each section includes worked code examples, common pitfalls, and best practices. Compile and run every example — do not just read the code. Then attempt the exercises to test your understanding.


Last updated: 24 July 2026

Written by Wyatt. For questions or feedback, visit wyattau.com.