About Interfaces
<1> interface content: method, attribute, indexer, and event.
<2> the interface members are public and abstract automatically. No modifiers can be added.
<3> interfaces are inherited in essence. When the interface methods are implemented implicitly, they cannot be overwritten.
<4> explicit interfaces cannot be modified using public or abstract statements. Explicit interfaces cannot be overwritten.
<5> when an explicit interface is called, it can only be called by itself. Example:
namespace ConsoleApplication10Inter{ interface Interd1 { void draw(); } interface Interd2 { void draw(); } class Class2 : Interd1,Interd2 { void Interd1.draw() { Console.WriteLine("draw in interface1"); } void Interd2.draw() { Console.WriteLine("draw in interface2"); } } class Program { static void Main(string[] args) { Class2 T = new Class2(); Interd1 d1 = (Interd1)T; d1.draw(); Interd2 d2 = (Interd2)T; d2.draw(); } }}
<6>
An interface is similar to an abstract base class: any non-Abstract type that implements an interface must implement all the members of the interface.
The interface cannot be instantiated directly.
Interfaces can contain events, indexers, methods, and attributes.
The interface does not contain the implementation of methods.
Classes and structures can inherit multiple interfaces.
The interface itself can be inherited from multiple interfaces.