interface IMyExample { string this[int index] { get ; set ; } event EventHandler Even ; void Find(int value) ; string Point { get ; set ; } } 从"ITextBox"和"IListBox"继承。
interface IDataBound { void Bind(Binder b) ; } public class EditBox: Control, IControl, IDataBound { public void Paint( ) ; public void Bind(Binder b) {...} }
string this[int index] { get ; set ; }
event EventHandler Even ;
void Find(int value) ;
string Point { get ; set ; }
}
从"ITextBox"和"IListBox"继承。
interface IControl {
void Paint( ) ;
}
interface ITextBox: IControl {
void SetText(string text) ;
}
interface IListBox: IControl {
void SetItems(string[] items) ;
}
interface IComboBox: ITextBox, IListBox { }
类和结构可以多重实例化接口。就像在下例中,类"EditBox"继承了类"Control",同时从"IDataBound"和"IControl"继承。
interface IDataBound {
void Bind(Binder b) ;
}
public class EditBox: Control, IControl, IDataBound {
public void Paint( ) ;
public void Bind(Binder b) {...}
}