mardi 28 janvier 2020

Initializing member variables with braces or parentheses

When initializing member variables in a constructor you can do it in these two different ways, using braces or parentheses:

class some_class {

some_class(): foo{<value>}, bar(<value>) {}

T foo;
T bar;
};

Is there a functional difference between these two initialization methods, and if so, which one should I opt to use?

Aucun commentaire:

Enregistrer un commentaire