Bridge mode in Java — an example of object structured mode
Bridge mode in Java -- an example of object structured mode
1、 Intention
Separate the abstract part from its implementation part so that they can change independently.
2、 Applicability
Bridge mode is used in the following cases
You don't want a fixed binding between the abstract and its implementation. For example, this may be because the implementation part should be able to be selected or switched at the running time of the program.
The abstraction of a class and its implementation should be extended by generating subclasses. At this time, the bridge pattern allows you to combine different abstract interfaces and implementation parts and expand them respectively.
The modification of an abstract implementation part should have no impact on the customer, that is, the customer code does not have to be recompiled.
(c + +) you want to completely hide the abstract implementation part from the customer. In C + +, the representation of a class is visible in the class interface.
3、 Structure
4、 Code
If you have any questions, please leave a message or go to this area of this site for exchange and discussion. Thank you for reading. I hope it can help you. Thank you for your support to this site!