static void Main(string[] args) { #region 基本结构 //Abstraction ab = new RefinedAbstraction(); //ab.SetImplementor(new ConcreteImplentorA()); //ab.Operation(); //ab.SetImplementor(new ConcreteImplentorB()); //ab.Operation(); #endregion HandsetBrand ab; ab = new HandsetBrandN(); ab.SetHandsetSoft(new HandsetGame()); ab.Run(); ab.SetHandsetSoft(new HandsetAddressList()); ab.Run(); ab = new HandsetBrandM(); ab.SetHandsetSoft(new HandsetGame()); ab.Run(); ab.SetHandsetSoft(new HandsetAddressList()); ab.Run(); Console.ReadKey(); }
static void Main(string[] args) { //桥接模式 Abstraction straction = new RefinedAbstraction(); straction.SetImplementor(new ConcreteImplementorA()); straction.Operation(); straction.SetImplementor(new ConcreteImplementorB()); straction.Operation(); Console.WriteLine("----------------------------------------"); HandsetBrand hb; hb = new HandsetBrandN(); hb.SetHandsetSoft(new Handsetgame()); hb.Run(); hb.SetHandsetSoft(new HandsetAddressList()); hb.Run(); hb = new HandsetBrandM(); hb.SetHandsetSoft(new Handsetgame()); hb.Run(); hb.SetHandsetSoft(new HandsetAddressList()); hb.Run(); Console.Read(); }
static void Main(string[] args) { HandsetBrand phone = new HandsetBrandN(); phone.SetHandsetSoft(new HandsetGame()); phone.Run(); phone.SetHandsetSoft(new HandsetAddressList()); phone.Run(); phone = new HandsetBrandM(); phone.SetHandsetSoft(new HandsetGame()); phone.Run(); phone.SetHandsetSoft(new HandsetAddressList()); phone.Run(); Console.WriteLine("\n"); Abstraction abstraction = new Abstraction(); abstraction.SetImplementor(new ConcreteImplementorA()); abstraction.Operation(); abstraction.SetImplementor(new ConcreteImplementorB()); abstraction.Operation(); Console.ReadLine(); }
static void Main(string[] args) { HandsetBrand ab = new HandsetBrandN(); ab.SetHandsetSoft(new HandsetGame()); ab.Run(); ab.SetHandsetSoft(new HandsetAddressList()); ab.Run(); ab = new HandsetBrandM(); ab.SetHandsetSoft(new HandsetGame()); ab.Run(); ab.SetHandsetSoft(new HandsetAddressList()); ab.Run(); Console.ReadKey(); }