Esempio n. 1
0
        public static void MainOLD()
        {
            var woodenDoorFactory       = new WoodenDoorFactory();
            var woodenDoor              = woodenDoorFactory.MakeDoor();
            var woodenDoorFactoryExpert = woodenDoorFactory.GetFittingExpert();

            var ironDoorFactory       = new IronDoorFactory();
            var ironDoor              = ironDoorFactory.MakeDoor();
            var ironDoorFactoryExpert = ironDoorFactory.GetFittingExpert();

            woodenDoor.GetDescription();
            woodenDoorFactoryExpert.GetDescription();

            ironDoor.GetDescription();
            ironDoorFactoryExpert.GetDescription();
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            WoodenDoorFactory  woodenDoorFactory = new WoodenDoorFactory();
            IDoor              door   = woodenDoorFactory.MakeDoor();
            IDoorFittingExpert expert = woodenDoorFactory.MakeDoorFittingExpert();

            door.GetDescription();
            expert.GetDescription();

            IronDoorFactory    ironDoorFactory = new IronDoorFactory();
            IDoor              door2           = ironDoorFactory.MakeDoor();
            IDoorFittingExpert expert2         = ironDoorFactory.MakeDoorFittingExpert();

            door2.GetDescription();
            expert2.GetDescription();

            Console.ReadKey();
        }
Esempio n. 3
0
        static void AbstractFactory()
        {
            WoodenDoorFactory woodenDoorFactory = new WoodenDoorFactory();

            var door   = woodenDoorFactory.makeDoor();
            var expert = woodenDoorFactory.makeFittingExpert();

            door.getDescription();
            expert.getDescription();



            IronDoorFactory ironDoorFactory = new IronDoorFactory();

            var door2   = ironDoorFactory.makeDoor();
            var expert2 = ironDoorFactory.makeFittingExpert();

            door2.getDescription();
            expert2.getDescription();
        }
        public static void Run()
        {
            Console.WriteLine("=-=-=-=AbstractFactory=-=-=-=");

            Console.WriteLine("WoodenDoorFactory");
            var woodenFactory = new WoodenDoorFactory();

            var door   = woodenFactory.MakeDoor();
            var expert = woodenFactory.MakeFittingExpert();

            door.GetDescription();   // Output: I am a wooden door
            expert.GetDescription(); // Output: I can only fit wooden doors

            Console.WriteLine(Environment.NewLine + "IronDoorFactory");
            var ironFactory = new IronDoorFactory();

            door   = ironFactory.MakeDoor();
            expert = ironFactory.MakeFittingExpert();

            door.GetDescription();   // Output: I am an iron door
            expert.GetDescription(); // Output: I can only fit iron doors

            Console.WriteLine("----------------------------------" + Environment.NewLine);
        }
Esempio n. 5
0
 public static void ImplementAbstractFactory()
 {
     WoodenDoorFactory woodenFactory = new WoodenDoorFactory();
     var door   = woodenFactory.makeDoor();
     var expert = woodenFactory.makeFittingExpert();
 }