When you have virtual inheritance it is the final class that must initialise the virtual base class.
Therefore the constructor of Join must construct Base:
class Join : public D1, public D2
{
public:
Join() : Base(3){} // or whatever value
~Join(){}
};
It is the exception to the rule that classes only normally initialise their immediate base-classes.
(Aside from that main
should return int
and you would need to do j->x
not j.x
as j is a pointer, as well as the fact you must delete
it as you called new
)