Design pattern Learning Notes-bridging mode

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.