C # use interface

1. What is the interface

Interface can be understood as a unified set of method declarations were named, but these methods do not provide any implementation, that is, to a set of methods declared in an interface, and then inherited from the class interface need to implement these methods.

Defined II. Interface

Definition of the class interface is very similar, except that the keyword is just not the same, the definition of the class using the class keyword, interfaces are defined using the interface keyword. Not add any modifier method defined in the interface, the interface as the default method is public, if the display is specified modifier,

Compile-time error occurs. In the interface, in addition to define a method, but also can contain properties, events, index or these four members (including the methods) any combination of types; but the interface types can not contain fields, operator overloading, instance constructors and destructors.

Guess you like

Origin www.cnblogs.com/QingYiShouJiuRen/p/11106194.html