1 usingSystem;2 3 namespaceBridge4 {5 /// <summary> 6 ///Bzyzhang7 ///time: 2016/5/31 7:19:038 ///Blog Address:http://www.cnblogs.com/bzyzhang/9 ///implementor Description: This code is copyright Bzyzhang all, use must bring Bzyzhang blog addressTen /// </summary> One Public Abstract classimplementor A { - Public Abstract voidoperation (); - } the}
View Code
1 usingSystem;2 3 namespaceBridge4 {5 /// <summary> 6 ///Bzyzhang7 ///time: 2016/5/31 7:20:358 ///Blog Address:http://www.cnblogs.com/bzyzhang/9 ///Concreteimplementora Description: This code is copyright Bzyzhang all, use must bring Bzyzhang blog addressTen /// </summary> One Public classConcreteimplementora:implementor A { - Public Override voidoperation () - { theConsole.WriteLine ("Implementation of a-specific method"); - } - } -}
View Code
1 usingSystem;2 3 namespaceBridge4 {5 /// <summary> 6 ///Bzyzhang7 ///time: 2016/5/31 7:21:258 ///Blog Address:http://www.cnblogs.com/bzyzhang/9 ///Concreteimplementorb Description: This code is copyright Bzyzhang all, use must bring Bzyzhang blog addressTen /// </summary> One Public classConcreteimplementorb:implementor A { - Public Override voidoperation () - { theConsole.WriteLine ("Implementation of the method of implementing B concretely"); - } - } -}
View Code
1 usingSystem;2 3 namespaceBridge4 {5 /// <summary> 6 ///Bzyzhang7 ///time: 2016/5/31 7:22:218 ///Blog Address:http://www.cnblogs.com/bzyzhang/9 ///Abstraction Description: This code is copyright Bzyzhang all, use must bring Bzyzhang blog addressTen /// </summary> One Public Abstract classAbstraction A { - protectedimplementor implementor; - the Public voidsetimplementor (implementor implementor) - { - This. implementor =implementor; - } + - Public Virtual voidoperation () + { A implementor. Operation (); at } - } -}
View Code
1 usingSystem;2 3 namespaceBridge4 {5 /// <summary> 6 ///Bzyzhang7 ///time: 2016/5/31 7:24:168 ///Blog Address:http://www.cnblogs.com/bzyzhang/9 ///refinedabstraction Description: This code is copyright Bzyzhang all, use must bring Bzyzhang blog addressTen /// </summary> One Public classrefinedabstraction:abstraction A { - Public Override voidoperation () - { the implementor. Operation (); - } - } -}
View Code
1 namespaceBridge2 {3 class Program4 {5 Static voidMain (string[] args)6 {7Abstraction AB =Newrefinedabstraction ();8 9Ab. Setimplementor (NewConcreteimplementora ());Ten AB. Operation (); One AAb. Setimplementor (NewConcreteimplementorb ()); - AB. Operation (); - } the } -}
View Code
Design pattern Learning Notes-bridging mode