I'm stunned by the downvotes and the insulting responses.
D
has four base classes. Of those, mid1
has one base class, virtual BS
, and mid2 has one base class,
virtual BS. There are no other uses of
virtual BS. So
mid1and
mid2share one copy of a
BSobject as their virtual base.
mid3has a **non**-virtual base,
BS; this is not shared. And
mid4has a
non-virtual base, BS
; this, too, is not shared. So there are three copies of BS
: one that is the virtual base of mid1
and mid2
, one that is the non-virtual base of mid3
, and one that is the non-virtual base of mid4
. Three BS
objects, so three constructor calls, so three "hello world"s.