. are "virtual" cannot be instantiated, which is why the interface cannot contain a field-member variable.
2. Because the interface is virtual, so the index within the interface, attributes, time and so can only have declarations, but not in the interface implementation, how to implement the derivation of the 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:
Copy Code code as follows:
Interface
SampInterface1
{
String
this[INT index]
{
Get
Set
}
Event EventHandler event;
void find (int value);
Note that there is no
{
}
String Po
Int
{
Get
Set
}
}
The above interface defines an index this, a practice event, a method find and a property point.
Copy Code code as follows:
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;)}
}
}