[Mono-list] A question about interfaces
Peter Wu
peterwu@whu.ca
Fri, 6 Feb 2004 22:20:32 -0500
On Sat, Feb 07, 2004 at 02:44:48AM +0000, Rodolfo Campero wrote:
> Hello all,
>
> I have a question about interfaces. I tried to compile the following
> program:
>
> <demo code snipped>
>
> but I got a CS0122 error:
>
> interfaces.cs(16) error CS0122: `InterfaceTests.IBottom.Count' is
> inaccessible due to its protection level
> Compilation failed: 1 error(s), 0 warnings
>
> I wonder why IBottom.Count is inaccessible, given the fact that neither
> ILeft nor IRight hide this property.
>
> I've read the documentation, and in ECMA-334 C# Language Specification,
> section 20.1.2: Base interfaces, there is a similar example involving
> IControl, ITextBox, IListBox and IComboBox, and the example states:
> "the IComboBox interface above inherits members SetText and SetItems as
> well as Paint." In the example, Paint is defined in the basic interface
> (IControl).
> And then in 20.2, "The members of an interface are the members inherited
> from the base interfaces and the members declared by the interface itself."
> From 20.4.2: "When a class implements multiple interfaces that have the
> same base interface, there can be only one implementation of the base
> interface."
>
> Apparently the property Count in my example shouldn't be hidden in the
> interface IBottom, yet I'm getting an error. Is this a bug in mcs or am I
> missing something?
Your code is compiled successfully under MS C# Compiler. I would think
this is a bug in mono.
--
Peter Wu
Powered by Gentoo Linux 2.4.22