Exemplo n.º 1
0
        public static Breakage Create(BreakageType type)
        {
            Breakage t;

            switch (type)
            {
            case BreakageType.wheel: t = new WheelBreakage(); break;

            case BreakageType.motor: t = new MotorBreakage(); break;

            case BreakageType.transmission: t = new TransmissionBreakage(); break;

            default: throw new Exception("Неккоректный тип поломки");
            }

            return(t);
        }
Exemplo n.º 2
0
        public static Breakage Create(double price, BreakageType type)
        {
            Breakage t;

            switch (type)
            {
            case BreakageType.to: t = new To(); break;

            case BreakageType.razval: t = new Razval(); break;

            case BreakageType.wheel: t = new Wheel(); break;

            default: throw new Exception("Некорректный тип услуги!");
            }
            t.price = price;
            return(t);
        }