
n a previous
column I explained the rules of
POD initialization. The rules of class member initialization are radically different, due to the fact that, in certain contexts, member initialization is mandatory. In addition, class constants have a wide range of initialization forms, depending on their type. The following sections shed some light on the intricate rules of class member initialization and show how to avoid common bugs and inefficiencies.

How do you initialize class members that require explicit initialization? How do you define class constants?

Distinguish between assignment and initialization. Use the appropriate initialization form according to the members type.