a eriksson
2005-08-09 13:17:41 UTC
Why is the call foo(c) below ambiguous when B inherits A privately? I
think that that contradicts the first error reported below since B
objects are not treated as A objects?
class A {};
class B : private A {};
class C : public B, public A {};
void foo(A& a) {}
int main() {
B b;
// foo(b); error: `A' is an inaccessible base of `B'
C c;
foo(c); // error: `A' is an ambiguous base of `C'
}
/ Andreas
think that that contradicts the first error reported below since B
objects are not treated as A objects?
class A {};
class B : private A {};
class C : public B, public A {};
void foo(A& a) {}
int main() {
B b;
// foo(b); error: `A' is an inaccessible base of `B'
C c;
foo(c); // error: `A' is an ambiguous base of `C'
}
/ Andreas