Well we all know why it is Required To resolve Diamond Problem
What if i have a code like this where class Bsse has no function and derived twice in Diamond way
Output:
in Base
In Der1
in Base
Der 2
Most Derived
Point is until we access any thing common in base class Explicitly there is NO issue
Lets see Accessing any variable from base :
Output : Compilation fails
virtual.cpp: In function `int main()':
virtual.cpp:31: error: request for member `Base_a' is ambiguous
virtual.cpp:6: error: candidates are: int Base::Base_a
virtual.cpp:6: error: int Base::Base_a
To solve we need Virtual inheritance .
Output : See the Constructor Sequence
in Base
In Der1
Der 2
Most Derived
Accessing Base_a 0