Introduced:
There are a lot of adapters in reality. Like a transformer, I would like to read this article you, is probably a student (at least once). Because right now in the dormitory to write this blog. I am in the dormitory will be rationing, high voltage will trip, can not use such equipment as induction cooker, you know, the university, the occasional dormitory members in the dormitory, can not use some cooking equipment, too inhuman there is wood (the system of spitting under the school), but there are some things called "Transformers" on the Internet, can help you solve this problem. Transformers can convert voltages. For example, the 220v into 110v, because of it, the dormitory can eat pot Na!
Here the work of the transformer is like the work of the adapter mode, so the adapter mode is often called the transformer mode. Then use the example on head, more image.
Object-oriented adapters:
Suppose you already have a software system that you want to use with a new vendor class library, but the interface that this new vendor involves is different from the old vendor's interface.
Then, we do not want to change the existing code, and can not change the manufacturer's code, so how to solve this problem. You can write another class that transforms the new vendor interface into the interface you expect.
This adapter is like a middleman that connects existing systems with vendor classes.