Exemplo n.º 1
0
        static void Main(string[] args)
        {
            TrafficFactory trafficFactory = new TrafficFactory();
            Traffic        traffic1       = trafficFactory.GetTraffic("火车");
            Traffic        traffic2       = trafficFactory.GetTraffic("大巴");

            traffic1.Ride(new User("张三"));
            traffic2.Ride(new User("李四"));
            Console.ReadKey();
        }