The interface has always been a programs that I know. I have a transparency programming. Before learning the interface, there are such problems need to be proposed: what what is interface? Why why should I use the interface? What is the advantage of the interface?) How to use the interface ? When, where when you use interface? If not does not use the interface, can you achieve the same design, if you can learn the difference between two scenarios, I learned that what is the interface: the interface is A special class interface that only declares that is not implemented is a convention, and the realization of the interface is strictly defined in accordance with the period definition. If the assumption is a definition keyhole, the interface is implemented. Class assumptions are the door lock, then I can ignore which lock I face in the execution, I just need to use the same key to open this class. The interface is an object to call the other object. A collection of methods knows. An object can have multiple interfaces (actually, the interface is a subset of all methods of the object) Type is a specific interface of the object. Different objects can have the same type, and an object can have a plurality of different types. An object can only be understood by other objects through its interface. In a sense, the interface is in a very limited manner, "is a ..." expression as "a support for this interface ...". The interface is the key of the pluggability. Why is the interface? (What is the use of the interface? What is the advantage of the interface? In the case where there is no existing code, the enhancement implementation of the interface will always minimize compatibility, or you can develop additional interfaces and implementation to add new features. Client does not have to know the specific object Classified. An object can be easily replaced with another object of (realized the same interface). The connection between the object does not have to hardbonize (hardwire) to a specific class object, thereby adding flexibility. Loosens Coupling. Increase the possibility of reuse. Improve the chance of (object) combination, because the object being included can be any class that implements a specified interface. Disadvantages: The complexity of the design is slightly increased (the translator Note: "..." like ... "(Likea) relationship, inheriting means" ... is ... "(ISA) relationship, combination means" ... there is ... " Relationship.)
How to use the interface? 1: In the module file defined in the module file End Sub Function Function1 (X AS Integer) End Sub Function FunctionInd Interface2: Use Implements in a class that needs to implement the interface. Public class myclass1 means .... End classwhen, when, where is the interface? if not does not use the interface, can you achieve the same design, if you can distinguish between two scenarios?