/// <summary> /// Адаптер /// </summary> public static void GoAdapterRusConscriptUSA() { Serviceman serviceman = new Conscript(); Print(serviceman.Greeting); Print(serviceman.CanICommand()); Print(serviceman.CanIEquipment()); Console.WriteLine(); RusificatedConscriptUSA rusificated = new RusificatedConscriptUSA(); Print(rusificated.Greeting); Print(rusificated.CanICommand()); Print(rusificated.CanIEquipment()); Console.ReadKey(); }
/// <summary> /// Делегирование /// </summary> public static void GoDelegateServiceman() { Serviceman serviceman; serviceman = new Conscript(); serviceman.CanICommand(); Console.WriteLine(); serviceman.CanIEquipment(); Console.WriteLine(); serviceman = new ExperiencedOfficer(); serviceman.CanICommand(); Console.WriteLine(); serviceman.CanIEquipment(); Console.WriteLine(); serviceman = new ContractTechnician(); serviceman.CanICommand(); Console.WriteLine(); serviceman.CanIEquipment(); Console.ReadKey(); }