课程: Python: Design Patterns (2021)
今天就学习课程吧!
今天就开通帐号,24,700 门业界名师课程任您挑!
Adapter
- [Speaker] The adapter pattern converts the interface of a class into another one a client is expecting. This time, our problem is that the interfaces are incompatible between a client and a server. In our scenario, we have Korean and British objects that have different method names for speaking. The client would like to use a uniform interface that is the speak method. Our solution is use the adapter pattern that translates the method names between the client and the server code. British and decorators are related to the adapter pattern.