Good day!
1) There are:
class A; class B: virtual public A; class C: virtual public A; class D: public B, public C;
In general, the classic constructors are called as: A B C D.
2) Do this:
class A; class B: public A; class C: virtual public A; class D: public B, public C;
As I understand it, this is perceived by the class D: AB (v) AC D. virtual A is transferred to the first place and we get the challenge of the constructors: (v) AACB D.
3) Now we do this:
class A; class D: public А, virtual public A;
As I understand it, this is perceived by the class D: A, (v) A. constructors call: (v) A. A. - this is according to the logic of the previous example, and so it is impossible, I can agree with that, well. But let's return to the first classic, as I understand it sees this class D: (v) AB (v) AC D. Let the virtuals go to the first place and be: (v) A (v) ABC D. According to my logic 2- of his example. Such cases, help deal with the sequence of calls to the designer in the virtual inheritance. Describe at least why only one basic constructor is called in the first classic and where it is written in descendants that this is necessary. Thank.
B
calls (or it decides whether or not to call) the constructors of its virtual base classes, this is the most derived -A
Then constructors of non - virtual classes are invoked as usual recursively. - VladD