<<< Initalizer list example | Index | Initializer list order >>> |
Initializer list is a preferred constructor syntax by most professionals for member initialization.
Initializer list must be used for:
References
Data members without default constructors
const member variables
If you do not explicitly initialize a data member in the initializer list, the compiler automatically initializes it using member's default constructor. For objects without default constructor this will be an error.
<<< Initalizer list example | Index | Initializer list order >>> |