Adapter

xiaoxiao2021-03-06  39

definition

Name: Adapter Structure: Intent: Convert a class interface into another interface that customers want. Adapter mode makes it possible to work with those classes that are not compatible with interfaces. Applicability: You want to use an existing class, and its interface does not meet your needs. You want to create a class that can be multiplexed, which can work with other unrelated classes or unpredictable classes (ie those that may not be compatible with those interfaces). (Only for object adapter) You want to use some already existing subclasses, but it is impossible to make subcatetics for each one to match their interfaces. The object adapter can adapt its parent class interface. effect:

Classic Case

1,

Best Practices

1,

Related mode

1,

Reference article

1,

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

New Post(0)