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) { Abstraction ab = new Abstraction(); ab.SetImplementor(new ConcreteImplementA()); ab.Operation(); ab.SetImplementor(new ConcreteImplementB()); ab.Operation(); Console.Read(); }
private static void Main() { Abstraction abstraction = new Abstraction(new ConcreteImplementorA()); abstraction.Operation(); abstraction = new Abstraction(new ConcreteImplementorB()); abstraction.Operation(); Console.ReadLine(); }
public void ClientCode(Abstraction abstraction) { Console.WriteLine(abstraction.Operation()); }