December 2018
Intermediate to advanced
512 pages
8h 51m
English
This chapter covers the adapter pattern.
Convert the interface of a class into another interface that clients expect. Adapter lets classes work together that could not otherwise because of incompatible interfaces.
The core concept is best described by the following examples.
A very common use of this pattern can be seen in an electrical outlet adapter/AC power adapter in international travels. These adapters act as a middleman when an electronic device (let’s say, a laptop) that accepts a US power supply can be plugged into a European power outlet. ...