Here is an example of multiple inheritance. I used the scope resolution operator to resolve the ambiguity instead of a virtual class.
struct A
{
int i;
};
struct B : A
{};
struct C : A
{};
struct D: B, C
{
void f()
{
B::i = 10;
}
void g()
{
std::cout << B::i <<std::endl;
}
};
int main()
{
D d1;
d1.f();
d1.g();
return 0;
}
Is B::i
well-formed?