Skip to content

Bridge pattern

1、是在学习 C++ pimpl idiom 的时候,发现的Bridge pattern。

2、它能够实现: information hiding: Separate interface from implementation

3、从C++ pimpl idiom 的角度出发,理解Bridge pattern会相对比较容易

wikipedia Bridge pattern

The bridge pattern is a design pattern used in software engineering that is meant to "decouple an abstraction from its implementation so that the two can vary independently", introduced by the Gang of Four.[1] The bridge uses encapsulation, aggregation, and can use inheritance to separate responsibilities into different classes.

When there is only one fixed implementation, this pattern is known as the Pimpl idiom in the C++ world.