The bridge mode is used to separate abstraction and implementation so that both of them can change.
The simple implementation code is as follows:
# Include <iostream> using namespace std; class Implementor {public: virtual void Operation () = 0 ;}; class ConcreteImplementorA: public Implementor {public: virtual void Operation () {cout <"execution of specific method to implement A" <endl ;}; class ConcreteImplementorB: public Implementor {public: virtual void Operation () {cout <"execution of specific method to implement B" <endl ;}; class runtime action {protected: Implementor * implementor; public: virtual void SetImplementor (Implemen Tor * implementor) {this-> implementor = implementor;} virtual void Operation () = 0; virtual ~ Failed action () {}}; class refined1_action: public 1_action {public: virtual void Operation () {implementor-> Operation ();} virtual ~ RefinedAbstraction () {if (implementor) delete implementor ;}}; int main () {role action * AB = new RefinedAbstraction (); AB-> SetImplementor (new ConcreteImplementorA ()); AB-> Operation (); delete AB; AB = new refined1_action (); AB-> SetImplementor (new ConcreteImplementorB (); AB-> Operation (); delete AB; return 0 ;}