C++ Programming
C++ builds on C. Almost everything in C programming still applies: memory addresses, the stack and heap, structs, and the toolchain. C++ adds ways to organize code, tie resources to lifetimes, and catch mistakes at compile time instead of at 3 a.m. when a motor keeps running after a fault.
This section is for students who know C and want to understand what C++ brings to embedded work — and what to leave switched off on a small MCU.
Articles are read in order. Each explains why before how. Use "In plain terms" boxes when you want the simplest mental picture.
Reading order
- Introduction to C++ — what changes from C; why teams pick C++
- Classes and encapsulation — grouping data and behaviour;
public/private - Constructors, RAII, and destructors — automatic setup and cleanup
- References and const correctness — safer parameters; values that must not change
- Namespaces and code organization — naming, headers, modular firmware
- Templates and generic code — one implementation, many types; flash cost
- Embedded C++ subset — exceptions,
new, STL, and practical rules for MCUs
Before you start
Complete the core C programming track first — especially Pointers in C, Structures and user types, and Pointers in depth. C++ is not a shortcut around memory; it adds structure on top of the same machine.
After this section
Use C++ where your platform allows it — see Firmware architecture. Many HALs and frameworks (Arduino wiring as C++, mbed, modern STM32 code) mix C drivers with C++ application layers.