I have the following classes and 'dreaded diamond':
A
/ \
/ \
B C
\ /
\ /
D
|
|
E
|
Classes B & C both inherit from A using public virtual A.
E is the only concrete class. None of the classes are totally abstract.
Every class has a copy constructor.
All of the copy constructors are chained together through the initialization lists.
E correctly calls D's copy constructor.
D correctly calls B and C's copy constructors.
But neither B nor C call A's copy constructor, although A's default constructor is called. To reiterate B and C have a call to A's copy constructor in their initialization lists.
I guess A's default constructor is being called is because of virtual inheritence, but why isn't its copy constructor called (too)?
A's copy constructor includes some very important code and I could do with calling it. Should I call it from the concrete class' initialization list or is that considered bad form?