I have the following class definitions in c++:
struct Foo {
  int x;
  char array[24];
  short* y;
};
class Bar {
  Bar();
  int x;
  Foo foo;
};
and would like to initialize the "foo" struct (with all its members) to zero in the initializer of the Bar class. Can this be done this way:
Bar::Bar()
  : foo(),
    x(8) {
}
... ?
Or what exactly does the foo(x) do in the initializer list?
Or is the struct even initialized automatically to zero from the compiler?
 
     
     
    