public IFlights Create( FlightType flightType) { IFlights flight = null; switch (flightType) { case FlightType.Cyclic: { flight = new CyclicFlight(); } break; case FlightType.Normal: { flight = new NormalFlight(); } break; default: return(new NullObjectFlight()); } return(flight); }
static void Main(string[] args) { FlightType flightType = FlightType.TypAdamowy; //================================= ProductFactory factory = new ProductFactory(); IFlights flight = factory.Create(flightType); flight.ExampleMethod(); Console.ReadKey(); }
public FlightsController(IFlights flightsService) { _flightsService = flightsService; }