Exemplo n.º 1
0
        public void BridgeTest()
        {
            {
                var a = new ConcreteImplementorA();
                var b = new ConcreteImplementorB();

                var ra = new RefinedAbstractionA();
                var rb = new RefinedAbstractionB();
                ra.SetImplementor(a);
                ra.Operation();

                ra.SetImplementor(b);
                ra.Operation();
            }

            {
                var black = new BlackCoffee();
                var white = new WhiteCoffee();

                var large = new LargeCupCoffee(black);
                large.Make();
                large.SetCoffee(white);
                large.Make();

                var medium = new MediumCupCoffee(black);
                medium.Make();
                medium.SetCoffee(white);
                medium.Make();
            }
        }
Exemplo n.º 2
0
    static void Main()
    {
        Implementor a = new ConcreteImplementorA();
        Implementor b = new ConcreteImplementorB();

        Abstraction A = new RefinedAbstractionA(a);
        Abstraction B = new RefinedAbstractionB(b);

        A.Action("AAA: ");
        Console.WriteLine("**************************");
        B.Action("BBB: ");
    }