Tony said:
Hello Experts!
It it correct to say that a solution to the diamond problem is to use
virtual inheritance with virtual base classes.
//Tony
Yeah, that is one of the most popular and efficient solutions to the
diamond problem.
class base
{
--
};
class der1
ublic base
{
--
};
class der2
ublic base
{
--
}
class sub_der
ublic der1, der2
{
--
}
Soo, now sub_der would have 2 copies of base, one from der1's side and
the other from der2's side. To prevent this we can have the base class
derived virtually.
Just to add, a point which is OT here but in Java, this situation never
arises since it does not support multiple inheritance. But again this
point I said above is completely off-topic.