Beispiel #1
0
        static void Main(string[] args)
        {
            Logistics log   = new SeaLogistics();
            var       prod1 = log.CreateTransport("Рыба");

            log = new RoadLogistics();
            var prod2 = log.CreateTransport("Мясо");

            Console.ReadKey();
        }
        public static Transport CreateTransport(string type, string whatToDeliver, Coordinate[] transportPoints)
        {
            if (type.Equals("sea"))
            {
                return(Sea.CreateTransport(whatToDeliver, transportPoints));
            }
            else if (type.Equals("road"))
            {
                return(Road.CreateTransport(whatToDeliver, transportPoints));
            }

            return(new UnknownTransport(whatToDeliver, null));
        }
Beispiel #3
0
        public static Transport CreateTransport(string type, string whatToDeliver, Coordinate from, Coordinate to)
        {
            if (type.Equals("sea"))
            {
                return(Sea.CreateTransport(whatToDeliver, from, to));
            }
            else if (type.Equals("road"))
            {
                return(Road.CreateTransport(whatToDeliver, from, to));
            }
            else if (type.Equals("air"))
            {
                return(Air.CreateTransport(whatToDeliver, from, to));
            }

            return(new UnknownTransport(whatToDeliver, null));
        }