static void Main(string[] args) { IFactory factory = FactoryContainer.factory; IWindow window = factory.MakeWindow(); Console.WriteLine("创建 " + window.ShowInfo()); IButton button = factory.MakeButton(); Console.WriteLine("创建 " + button.ShowInfo()); ITextBox textBox = factory.MakeTextBox(); Console.WriteLine("创建 " + textBox.ShowInfo()); Console.ReadLine(); }
static void Main(string[] args) { IWindow window = ReflectionFactory.MakaWindow(); IButton button = ReflectionFactory.MakaButton(); ITextBox textBox = ReflectionFactory.MakeTextBox(); //IWindow window = factory.MakaWindow(); Console.WriteLine("创建 " + window.ShowInfo()); //IButton button = factory.MakeButton(); Console.WriteLine("创建 " + button.ShowInfo()); //ITextBox textBox = factory.MakeTextBox(); Console.WriteLine("创建 " + textBox.ShowInfo()); Console.ReadLine(); }