コード例 #1
0
        public static Engine MakeEngine(string engineType)
        {
            Engine engine;

            switch (engineType)
            {
                case "Gasoline":
                    engine = new GasolineEngine();
                    break;
                case "Solar":
                    engine = new SolarEngine();
                    break;
                default:
                    return null;
                    break;
            }
            return engine;
        }
コード例 #2
0
        public static Engine MakeEngine(string engineType)
        {
            Engine engine;

            switch (engineType)
            {
            case "Gasoline":
                engine = new GasolineEngine();
                break;

            case "Solar":
                engine = new SolarEngine();
                break;

            default:
                return(null);

                break;
            }
            return(engine);
        }