[Mono-list] A question about interfaces

Rodolfo Campero rodolfocampero@hotmail.com
07 Feb 2004 11:58:10 +0100


When I was going to file a bug report, I found out this bug was already
reported: bug #53255.

Thanks Peter for checking it on csc.


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