Пример #1
0
 public void addCoach(coachType type)
 {
     coach             = FactoryModel.coachFactory(type, null, null, false);
     coach.coachNumber = count;
     addSeats();
     coaches.Add(coach);
     count++;
 }
    public static CoachInterface coachFactory(coachType type, List <Driver> driver, Journey destination, bool service
                                              )
    {
        switch (type)
        {
        case coachType.largeCoach:
            return(new LargeCoach(driver, destination, service));

        case coachType.mediumCoach:
            return(new MediumCoach(driver, destination, service));

        case coachType.smallCoach:
            return(new SmallCoach(driver, destination, service));

        default:
            return(null);
        }
    }