Lets suppose situation.
struct Top
{
int x;
};
struct Left : public Top
{};
struct Right : public Top
{};
struct Bottom : public Left, public Right
{
void foo()
{
Left::x; // Normal compiled
}
void goo()
{
Left::Top::x; // error: ‘Top’ is an ambiguous base of ‘Bottom’ // Why --- ????
}
};
Could someone explain me why in function goo() compiler give ambiguity error?
I wrote void foo() to show that if i access x by qualifier Left::x; there is no ambiguity, so why when i use more detailed access qualifier Left::Top::x; ambiguity appears?