Exemple #1
0
        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();
        }
Exemple #3
0
 public FlightsController(IFlights flightsService)
 {
     _flightsService = flightsService;
 }