コード例 #1
0
        public static IInstrumentoFactoryMethod CriaFabrica(InstrumentoType instrumentoType)
        {
            switch (instrumentoType)
            {
            case InstrumentoType.Violao:
            {
                return(new ViolaoFactory());
            }

            case InstrumentoType.Guitarra:
            {
                return(new GuitarraFactory());
            }

            case InstrumentoType.ContraBaixo:
            {
                return(new ContraBaixoFactory());
            }

            default:
                throw new ArgumentOutOfRangeException(nameof(instrumentoType), instrumentoType, null);
            }
        }
コード例 #2
0
 protected InstrumentoCordaBase(string modelo, InstrumentoType instrumentoType, short numeroCordas)
 {
     InstrumentoType = instrumentoType;
     NumeroCordas    = numeroCordas;
     Modelo          = modelo;
 }