📖 Book · cpp core · high
🧬 Constructor inheritance, init order & the Rule of 5
Passing args to a base, the fixed initialization order, inheriting constructors, and how the Rule of 5 propagates through a hierarchy.
Forward base-class arguments in the member initializer list; initialization runs base -> members (in declaration order, not init-list order) -> body; inherit base constructors with using Base::Base (which leaves added members default-initialized); and put the Rule of 5 in the resource-owning base while derived classes stay Rule of 0. Every example compiles and runs in the browser.
4 chapters▶ runnable code✦ in-depth animation
What this book covers
- 01Passing arguments to a base constructor
- 02Initialization order — and the declaration-order trap
- 03Inheriting constructors: `using Base::Base`
- 04The Rule of 5 in an inheritance hierarchy
Read it in full — runnable C++ + step-through animations
Every chapter of Constructor inheritance, init order & the Rule of 5 ships complete, editable code you compile and run in the browser, plus the same in-depth animations as the lessons.