I have a question regarding initialization lists when I'm not initializing all the items.
Let's say I have the following code:
class Example {
int a, b, c;
Example() : a(1), b(2), c(3) {}
}
I'm aware that the order of initialization of members is defined by their order of declaration, not by the order in which they are listed in the initialization list, but, what if I don't have b in the initialization list as in the following?
class Example {
int a, b, c;
Example() : a(1), c(2) {}
}
Will a be initialized with 1, b with an undefined value and c with 3? Will I get an undefined behavior because I'm not calling the initialization list strictly with the order I'm declaring? Or none of this?
I'm asking this because I have a class with a lot of data and I want to make sure some of it have an initial value, but I don't need to initialize all of it.