R
Rajib
If I have the following code
class B {
public: int b;
};
class C : public B {};
class E : public C, public B {};
int main() {
E x;
C y;
x.C::B::b++; //test3.cpp:14: error: ‘B’ is an ambiguous base of ‘E’
y.b++;
y.B::b++;
return 0;
}
Why is this ambiguous? I thought the compiler would look up C (and find
it unambiguously) and then use that to look up C::B (again finding it
unambiguously).
Thanks
class B {
public: int b;
};
class C : public B {};
class E : public C, public B {};
int main() {
E x;
C y;
x.C::B::b++; //test3.cpp:14: error: ‘B’ is an ambiguous base of ‘E’
y.b++;
y.B::b++;
return 0;
}
Why is this ambiguous? I thought the compiler would look up C (and find
it unambiguously) and then use that to look up C::B (again finding it
unambiguously).
Thanks