If I define a structure that inherits from multiple other structures, how does the order that I list them in affect something like this:
struct D: C,B{
D(): B(), C(){...}
};
Simple question, but thanks in advance!
If I define a structure that inherits from multiple other structures, how does the order that I list them in affect something like this:
struct D: C,B{
D(): B(), C(){...}
};
Simple question, but thanks in advance!
Copyright © 2021 Jogjafile Inc.
The order of construction depends on the sequence of inheritance. Initialization order doesn't matter. GCC actually issues warning in this case.
It is clearly specified in the standard as well. From section 12.6.2 Initializing bases and members