示例#1
0
        static void Main(string[] args)
        {
            #region 基本结构
            //Abstraction ab = new RefinedAbstraction();

            //ab.SetImplementor(new ConcreteImplentorA());
            //ab.Operation();

            //ab.SetImplementor(new ConcreteImplentorB());
            //ab.Operation();
            #endregion

            HandsetBrand ab;
            ab = new HandsetBrandN();

            ab.SetHandsetSoft(new HandsetGame());
            ab.Run();

            ab.SetHandsetSoft(new HandsetAddressList());
            ab.Run();


            ab = new HandsetBrandM();

            ab.SetHandsetSoft(new HandsetGame());
            ab.Run();

            ab.SetHandsetSoft(new HandsetAddressList());
            ab.Run();

            Console.ReadKey();
        }
示例#2
0
        static void Main(string[] args)
        {
            //桥接模式
            Abstraction straction = new RefinedAbstraction();

            straction.SetImplementor(new ConcreteImplementorA());
            straction.Operation();

            straction.SetImplementor(new ConcreteImplementorB());
            straction.Operation();

            Console.WriteLine("----------------------------------------");

            HandsetBrand hb;

            hb = new HandsetBrandN();
            hb.SetHandsetSoft(new Handsetgame());
            hb.Run();
            hb.SetHandsetSoft(new HandsetAddressList());
            hb.Run();


            hb = new HandsetBrandM();
            hb.SetHandsetSoft(new Handsetgame());
            hb.Run();
            hb.SetHandsetSoft(new HandsetAddressList());
            hb.Run();

            Console.Read();
        }
示例#3
0
        static void Main(string[] args)
        {
            HandsetBrand phone = new HandsetBrandN();

            phone.SetHandsetSoft(new HandsetGame());
            phone.Run();

            phone.SetHandsetSoft(new HandsetAddressList());
            phone.Run();

            phone = new HandsetBrandM();

            phone.SetHandsetSoft(new HandsetGame());
            phone.Run();

            phone.SetHandsetSoft(new HandsetAddressList());
            phone.Run();

            Console.WriteLine("\n");

            Abstraction abstraction = new Abstraction();

            abstraction.SetImplementor(new ConcreteImplementorA());
            abstraction.Operation();

            abstraction.SetImplementor(new ConcreteImplementorB());
            abstraction.Operation();

            Console.ReadLine();
        }
示例#4
0
        static void Main(string[] args)
        {
            HandsetBrand ab = new HandsetBrandN();

            ab.SetHandsetSoft(new HandsetGame());
            ab.Run();
            ab.SetHandsetSoft(new HandsetAddressList());
            ab.Run();

            ab = new HandsetBrandM();
            ab.SetHandsetSoft(new HandsetGame());
            ab.Run();
            ab.SetHandsetSoft(new HandsetAddressList());
            ab.Run();

            Console.ReadKey();
        }