This question already has an answer here:
As a general rule,initialization values may be specified with parentheses, an equals sign, or braces in C++11
int x(0); // initializer is in parentheses
int y = 0; // initializer follows "="
int z{ 0 }; // initializer is in braces
what is the difference between these three type of initialization and when should we use each type of initialization? what are pros and cons of each?
Aucun commentaire:
Enregistrer un commentaire