A
aakash
Suppose in file a.hpp, we have a struct
struct Base
{
static int x;
}
int Base::x = 1;
and in file b.hpp, we have a struct
struct Derived: Base
{
static int y;
}
int Derived::y = 2;
Is it guaranteed that when we compile these two class file, static
variable x will be initialized before static variable y?
I know that initialization of static variables are not defined, but
since x is in a base class, will it be first initialized?
struct Base
{
static int x;
}
int Base::x = 1;
and in file b.hpp, we have a struct
struct Derived: Base
{
static int y;
}
int Derived::y = 2;
Is it guaranteed that when we compile these two class file, static
variable x will be initialized before static variable y?
I know that initialization of static variables are not defined, but
since x is in a base class, will it be first initialized?