All topics / C++ From Zero

C++ From Zero

Learn C++ as its own language, not 'C with extras': the object model, RAII, value semantics, templates, the STL, and modern C++ - mental-model-first, from your first compile to why the Rule of Five exists.

Download EPUB
  1. Compiling & Your First Program What actually happens when you turn C++ source into a running program, and how to compile and run your first one.
  2. From C to C++: What Changed What actually changed when C++ grew out of C - stronger types, references, overloading, new/delete, namespaces, and why C++ is a different language to think in, not just C with extra keywords.
  3. Types, Variables & Control Flow What does C++ actually add to C's types and control flow - and how do bool, auto, references-in-loops, and enum class change the way you write everyday code?
  4. Functions, Overloading & Default Arguments How C++ functions go beyond C's one-name-one-signature rule: overloading lets several functions share a name, and default arguments let a single function cover several call shapes - so what does the compiler actually do to pick the right one?
  5. References vs Pointers A pointer is a variable holding an address and can be null, reseated, or left dangling; a reference is an alias for an existing object that must be bound once and can never be null - and knowing which tool to reach for is the first step toward writing C++ that doesn't corrupt memory.
  6. Classes & Objects A class bundles data with the functions that operate on it into one type you control - this phase builds the mental model of objects, member functions, and access control that everything else in C++ is built on.
  7. Constructors, Destructors & RAII How does a C++ object set itself up and clean itself up automatically, and why does everyone say RAII is the single most important idea in the language?
  8. Copy, Move & the Rule of Five What actually happens when you write `Widget b = a;`, why the compiler-generated copy can silently corrupt your program, and how the Rule of Five (and its lazier cousin, the Rule of Zero) let you control it.
  9. Operator Overloading How do you make + and == and << work on your own classes the same way they work on int and double, and where's the line between convenience and confusing your reader?
  10. Templates & Generic Programming How do you write max() or a Vector once and have it work for int, double, and your own types, without copy-pasting the function for each one? C++ answers with templates - code that the compiler writes for you, per type, at compile time.
  11. The STL: Containers What is std::vector and when should I reach for map, set, or deque instead - and why do C++ containers copy everything by value unless you tell them not to?
  12. The STL: Iterators & Algorithms How do you write one sort() that works on a vector, a list, and a deque without three copies of the code? Iterators are the answer - a generalized pointer that lets algorithms and containers stay completely decoupled.
  13. Smart Pointers & Modern Memory Management Do I still need raw new and delete in modern C++? No - unique_ptr, shared_ptr and weak_ptr apply the RAII you already learned to heap memory itself, so ownership is tracked by the type system instead of by your memory.
  14. Inheritance & Polymorphism How does C++ let one function call behave differently depending on the actual object underneath it - and what is a vtable really doing?
  15. Error Handling: Exceptions and Alternatives How does C++ report and recover from failure - and when should you reach for an exception versus a return value that might not be there?
  16. Modern C++: auto, Lambdas, Ranges & What Changed Since C++11 What actually changed when C++11 landed, and how do auto, lambdas, and C++20 ranges let you write C++ that reads nothing like the C++ from before?
  17. Undefined Behavior, Gotchas & Where to Go Next Why does C++ code that compiles fine sometimes just misbehave, with no error and no crash you can point to - and once you can see that pattern, where do you go to keep getting better at C++?