X hits on this document





288 / 396

Chapter ‎18   Unsafe code

The explicit base interfaces of an interface must be at least as accessible as the interface itself (§‎3.5.4). For example, it is a compile-time error to specify a private or internal interface in the interface-base of a public interface.

It is a compile-time error for an interface to directly or indirectly inherit from itself.

The base interfaces of an interface are the explicit base interfaces and their base interfaces. In other words, the set of base interfaces is the complete transitive closure of the explicit base interfaces, their explicit base interfaces, and so on. An interface inherits all members of its base interfaces. In the example

interface IControl { void Paint(); }

interface ITextBox: IControl { void SetText(string text); }

interface IListBox: IControl { void SetItems(string[] items); }

interface IComboBox: ITextBox, IListBox {}

the base interfaces of IComboBox are IControl, ITextBox, and IListBox.

In other words, the IComboBox interface above inherits members SetText and SetItems as well as Paint.

A class or struct that implements an interface also implicitly implements all of the interface’s base interfaces.

13.1.3 Interface body

The interface-body of an interface defines the members of the interface.

interface-body: {   interface-member-declarationsopt   }

13.2 Interface members

The members of an interface are the members inherited from the base interfaces and the members declared by the interface itself.

interface-member-declarations: interface-member-declaration interface-member-declarations   interface-member-declaration

interface-member-declaration: interface-method-declaration interface-property-declaration interface-event-declaration interface-indexer-declaration

An interface declaration may declare zero or more members. The members of an interface must be methods, properties, events, or indexers. An interface cannot contain constants, fields, operators, instance constructors, destructors, or types, nor can an interface contain static members of any kind.

Copyright Microsoft Corporation 1999-2003. All Rights Reserved.275

Document info
Document views1307
Page views1307
Page last viewedSat Jan 21 09:31:24 UTC 2017