Ejemplo n.º 1
0
        // a method that creates whole booking from the details provided. It never returns AbstractBooking,
        // but one of it's descendants
        public AbstractBooking CreateBooking(int bookingRef, DateTime startDate, DateTime endDate, Client client, List <Person> guests,
                                             int chaletId, bool eveningMeal, bool breakfast, bool carHire, DateTime hireStart, DateTime hireEnd, string driver)
        {
            BookingFactorySingleton factory = BookingFactorySingleton.Instance();

            return(factory.FactoryMethod(bookingRef, startDate, endDate, client, guests, chaletId, eveningMeal, breakfast, carHire, hireStart, hireEnd, driver));
        }
Ejemplo n.º 2
0
 // a method that returns an instance of the class. If there is no instance then it creates a new
 // one, if there is it returns that instance
 public static BookingFactorySingleton Instance()
 {
     if (_instance == null)
     {
         _instance = new BookingFactorySingleton();
     }
     return(_instance);
 }