I have the next structs:
struct B
{
int a;
int b;
};
struct D: public B
{
int c;
};
I want to initialize some variable of struct D in compile time, like if I would initialize the struct B it would looks like:
B b1 = { value_of_a, value_of_b };
I tried to do this in next ways, but it didn't compile:
D d1 = { { value_of_a, value_of_b } , value_of_c };
D d2 = { value_of_a, value_of_b , value_of_c };
If I change the struct to:
struct D
{
B bb;
int c;
};
it compiles with "d1" and "d2" initialization.
So, the question is how I can initialize the derived struct? And if there is now rule for initializing derived struct, what is the reasons?
Thank you.