Daniel Mitchell wrote:
struct PrivateBase { };
struct PublicBase { };
void foo( PrivateBase ) { }
void foo( PublicBase ) { }
struct Derived : PublicBase, private PrivateBase { };
int main()
{
Derived d;
foo( d ); // ambiguous
}
Why doesn't the call to foo( d ) resolve to foo( PublicBase )? Is this
a language defect?
This is by design.
[Member access control]
11§4 It should be noted that it is access to members and base classes
that is controlled, not their visibility. Names of members are still
visible, and implicit conversions to base classes are still considered,
when those members and base classes are inaccessible. The
interpretation of a given construct is established without regard to
access control. [...]
Jonathan