예제 #1
0
        public static void Test()
        {
            Console.WriteLine("### FactoryMethod");

            IFactory factory;

            factory = new ThinFactory();
            var kappaChan = factory.Create();

            kappaChan.Eat();

            Console.WriteLine("--- Factoryの入れ替え");

            factory = new FatFactory();
            var kappaSan = factory.Create();

            kappaSan.Eat();
        }
예제 #2
0
        public static void Test()
        {
            Console.WriteLine("### AbstractFactory");

            IFactory  factory;
            IKappa    kappa;
            ICucumber cucumber;

            factory  = new ThinFactory();
            kappa    = factory.kappaFactory();
            cucumber = factory.cucumberFactory();
            kappa.JikoShoukai();
            cucumber.Taste();

            Console.WriteLine("--- Factoryの入れ替え");

            factory  = new FatFactory();
            kappa    = factory.kappaFactory();
            cucumber = factory.cucumberFactory();
            kappa.JikoShoukai();
            cucumber.Taste();
        }