1. All are "imaginary" cannot be instantiated, this is why the interface cannot contain fields--member variables--reason 2. Because the interface is virtual, the index, attributes, time, and so on in the interface can only be declared, but not within the interface, how to implement is derived interface or derived classes.
3. All have the nature of the template, if an interface or class inherits from an interface, it will automatically have the characteristics of the integrator (including indexes, attributes, functions, practices, etc.).
4. Interfaces support multiple inheritance, whereas in C #, classes support a single inheritance, and interfaces actually represent a load capacity,
The following is a simple definition of an interface:
interface
SampInterface1
{
string
this[ int index]
{
get;
set
}
;
event EventHandler Event;
void Find( int value );
//注意此处没有
{
}
string Po
int
{
get;
set
}
;
}
The above interface defines an index
This, a practice event, a method find and a property point.
public interface SampIneterface:SampIneterface1{
pravite int a=1;
void find (int value)
{
a+=value;
}
event EventHandler Event;
protected void onEvent()
{
if(Event=null)
{return Event(this.System.EventAgrs.Empty;)}
}
}