Why Write Tests Helps catch bugs in the code, and in the programmer’s mental model of what the code does.
The later a bug is caught in the development cycle, the more expensive it is to fix it. A good test today is a future debugging session saved.
The test is the first client of your code. It uncovers sub-optimal design choices, tight couplings, missed cases, etc....
Unscoped (or Plain or C-Style) Enumerations Plain (or C-style) enums are entered in the same scope as the name of their enum, and implicitly convert to their integer value, e.g.
enum Color { red, green, blue }; int col = green; Color c2 = 1; // error: invalid conversion from 'int' to 'Color' [-fpermissive] enum CardColor { red, black }; // Error: "red" conflicts with a previous declaration...
Resource Handles RAII is also covered in Classes in C++ > Motivation for the Destructor Mechanism The constructor/destructor pattern enables objects defined in a scope to release the resources during exit from the scope, even when exceptions are thrown. All standard-library containers, e.g. std::vector, are implemented as resource handles.
std::unique_ptr and std::shared_ptr These “smart pointers” are useful in managing objects that are allocated on the free store (as opposed to those allocated on the stack)....
quotes Doug McIlroy:
Those types are not “abstract”; they are as real as int and float.
What is the context of this quote?
A class is a user-defined type provided to represent a concept in the code of a program. Essentially, all language facilities beyond the fundamental types, operators, and statements exist to help define better class or to use them more conveniently....