Bridge is used to decouple abstraction from realization, so that they can change independently. This type of design pattern belongs to structural pattern, which realizes the decoupling of abstraction and realization by providing a bridge structure between abstraction and realization.
It is mainly applicable to the changes of two dimensions. For example, I want to create wheels of different sizes and colors. At this time, the color and wheel are separate. At this time, two interfaces are required, one is color and the other is size. This is to connect the color and size. This is
Create a color structure, and then create an abstract class of size. Create a reference to color in the size. You need to pass in an instance of color in the construction method. At this time, there are color and size in the subclass of size. At this time, you can create wheels of various sizes and colors