Overview of the interface (interface)

Overview of the interface
above the computer motherboard has a lot of interfaces, such as memory interfaces, with this interface, you can insert multiple memory, motherboard and memory can be
can not be the same one manufacturer, but both the object was able to bind to - since, precisely because of the existence of this interface. As long as manufacturers follow this access
port, motherboard and memory can be free to change and improve the pluggable interface it is actually embodies a norm.
Use interface to declare an interface in java language which, in fact, the interface is - - a special abstract classes, methods inside the interface of all
abstract.
About the interface, there are a few caveats:
■ interface can appear only constants and abstract methods
■ Interface there is no constructor, you can not create an object interfaces
support multiple inheritance between ● interface and the interface, that can have more than one interface parent interface
. a class can implement multiple interfaces, that is - - a parent class can have multiple interfaces
. a class that implements the interface, then this class need all the abstract methods (recommended) interface rewrite, rewrite if you do not then this class
should be declared abstract class (not recommended)

The role of the interface
can project a layered, are for interface development, improve development efficiency
● reducing the coupling between the code of the code improves the pluggable
developed to make use of the interface, less abstract class - a class implement multiple interfaces, but can only inherit - a parent class

Because of it, the customer's request to change too frequently, so we use the interface because the interface can have multiple inheritance, so we inherit A demand when they are A, B when they demand that I inherited B, when they want a B want to have there, we can give him more than an inheritance

Guess you like

Origin www.cnblogs.com/JiXianSen/p/12142822.html