Hello all,

I have a question about interfaces. I tried to compile the following program:

<listing>
namespace InterfaceTests {
        interface ITop {
                int Count { get; }
        }

interface ILeft: ITop {}

interface IRight: ITop {}

interface IBottom: ILeft, IRight {}

        class Test {
                public static void Main () {}

                public void Testing (IBottom test) {
                        int a = test.Count;
                }
        }
}
</listing>

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?

TIA,

Rodolfo Campero

PS: BTW, is this the right list to ask this kind of questions, or would mono-devel-list be more appropriate?

_________________________________________________________________
The new MSN 8: advanced junk mail protection and 2 months FREE* http://join.msn.com/?page=features/junkmail


_______________________________________________
Mono-list maillist  -  [EMAIL PROTECTED]
http://lists.ximian.com/mailman/listinfo/mono-list

Reply via email to