I was asking myself something this morning, and I can't find the words to properly "google" for it:
Lets say I have:
struct Foo
{
int bar;
};
struct Foo2
{
int bar;
Foo2() {}
};
struct Foo3
{
int bar;
Foo3() : bar(0) {}
};
Now if I default instantiate Foo
, Foo2
and Foo3
:
Foo foo;
Foo2 foo2;
Foo3 foo3;
In which case(s) is the bar
member properly initialized ?
(Well Foo3
obviously explicitely initialize it and is only showed here to explicit the difference with Foo2
so the question is mainly about the first two.)
Thank you ! :)