interface

xiaoxiao2021-03-06  15

Interface Interface: First: Interface is the interface left by your function module, which needs to provide a function to the outside. Second: Interface implements multiple inheritance. Third: If there is a Class A, she has a lot of features, but Class B is more powerful than her functionality. It is necessary to give b's part of the function to B, which is very passive. If the public class a imports demo {} public class b imports demo {} is very easy. Fourth: interface makes the Class design and implementation. Class's provider to the Class Offer to ensure all the features defined by the interface. Client only implements the function of Class. Reduce (decrease) COUPLING between Layer and Layer. FIFTH: 1) From demand, the interface is the result of demand analysis. Only reacts what the system wants to do, not how to do it. 2) From the design perspective, Java advocates abstract programming. The specific meaning is that the client should only depend on abstract things, that is, the client is only programmed for the interface. 3) Use object-oriented, the most important thing is to use its polymorphism. The use of the interface is the path to the polymorphic avenue.

转载请注明原文地址:https://www.9cbs.com/read-67942.html

New Post(0)