Beispiel #1
0
 public AirportController(IAirport airport)
 {
     this.airport          = airport;
     this.airplaneFactory  = new AirplaneFactory();
     this.itemFactory      = new ItemFactory();
     this.passengerFactory = new PassengerFactory();
     this.tripFactory      = new TripFactory();
 }
Beispiel #2
0
        /// <summary>
        /// The basic abstract factory approach.
        /// </summary>
        private static void executeBasicExample(IPassengerFactory earthFactory)
        {
            // Create our passengers using the basic abstract factory methods.
            var astronaut = earthFactory.NewAstronaut();
            var cosmonaut = earthFactory.NewCosmonaut();
            var toy       = earthFactory.NewToy();

            // push buttons
            con(astronaut.Speak());

            // flip switch
            con(cosmonaut.Speak());

            // pull string
            con(toy.Speak());
        }