Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How does the web Class Adapter match the Interface

2025-01-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

Most people do not understand the knowledge points of this article "web class adapter how to match the interface", so the editor summarizes the following content, detailed content, clear steps, and has a certain reference value. I hope you can get something after reading this article. Let's take a look at this "web class adapter how to match the interface" article.

structure

The class adapter uses multiple inheritance to match one interface to another, as shown in the following figure.

The class adapter adapts by inheriting the adapted class. At this point, the instance of the adapted class and the instance of the adapted target class are the same object. Operations oriented to the adaptation target are transferred to call the instance's own methods that inherit from the adapted class.

The object adapter depends on the combination of objects, as shown in the following figure.

The object adapter adapts by holding the object of the adapted class, when the instance of the adapted target class maintains the instance of the adapted class. Operations oriented to the adaptation object will instead call the method of the adapted class.

Participant

Target (Shape)

-defines the domain-specific interfaces used by Client. This can be seen as the requirement of the target class.

Client (DrawingEditor)

-collaborate with objects that conform to the Target interface. There are no special requirements for the users of the adapter.

Adaptee (TextView)

-define an existing interface that needs to be adapted. This sentence may be debatable, because the adaptation of those interfaces does not depend on what Adaptee has, but on what Target needs.

Adapter (TextShape)

-adapt the interface of Adaptee to the interface of Target. The classes that really perform adaptation work have two ways: classful adaptation and object adaptation.

Collaboration

Client calls some operations in the Adapter instance. The adapter then invokes the operation of Adaptee to implement the request.

The request of the user of the Adapter interface, which is forwarded to Adaptee.

The above is the content of this article on "how web adapters match interfaces". I believe we all have some understanding. I hope the content shared by the editor will be helpful to you. If you want to know more about the relevant knowledge, please follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report