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(); }
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(); }