Part 3
Types you make
How to build a type that behaves as well as a built-in one: it copies correctly, cleans up after itself, and cannot be misused by accident.
-
3.1
Structs and classes
Grouping data, and deciding what the outside world may touch.
-
3.2
Constructors, destructors, and RAII
The idea that makes C++ safe without a garbage collector.
-
3.3
Copying
What it means to duplicate an object, and what the compiler writes for you.
-
3.4
Moving
Transferring ownership instead of duplicating, and what std::move really does.
-
3.5
The rule of zero, three, and five
How many special member functions you actually need to write.
-
3.6
Operator overloading
Making your type read like a built-in one, without making it lie.
-
3.7
Inheritance and virtual functions
Runtime polymorphism: how it works and what it costs.
-
3.8
When not to use inheritance
The design mistakes that inheritance makes easy.