From the course: C#: Design Patterns Part 1

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Adapter pattern definition

Adapter pattern definition - Python Tutorial

From the course: C#: Design Patterns Part 1

Start my 1-month free trial

Adapter pattern definition

- [Instructor] We all usually have adapters around to fit this peripheral into that laptop. If you do much travel internationally, you probably have an array of fancy wall power outlet adapters. The wall plug adapter is a great visual for the adapter pattern. The shape of the plug is the interface and to get power, you need to wrap your interface with the expected interface. This is the adapter pattern. It's also known as the wrapper pattern. Get one interface to look like another interface to be able to act as that interface. This allows classes to interact that were not originally intended to. There are two types of the adapter pattern, one that adapts at the class level. The other one does so at the object level, which are the two scopes that we mentioned for design pattern categorization. Let's look at this simple diagram for the class adapter. It uses multiple inheritance to make the adaption possible. It is an…

Contents