Пример #1
0
        public void AddInstrument(string serialNumber, double price, InstrumentSpec spec)                                            //Builder builder, string model, Type type, Wood backwood, Wood topwood)
        {
            Instrument instrument = null;

            if (spec.GetType() == typeof(GuitarSpec))
            {
                instrument = new Guitar(serialNumber, price, (GuitarSpec)spec);
            }
            else if (spec.GetType() == typeof(MandolinSpec))
            {
                instrument = new Mandolin(serialNumber, price, (MandolinSpec)spec);
            }
            instruments.Add(instrument);
        }
Пример #2
0
        public override bool Matches(InstrumentSpec otherspec)
        {
            if (!(base.Matches(otherspec)))
            {
                return(false);
            }
            if (!(otherspec.GetType() == typeof(GuitarSpec)))
            {
                return(false);
            }

            GuitarSpec spec = (GuitarSpec)otherspec;

            if (_numStrings != spec._numStrings)
            {
                return(false);
            }
            return(true);
        }
Пример #3
0
        public override bool Matches(InstrumentSpec otherspec)
        {
            if (!(base.Matches(otherspec)))
            {
                return(false);
            }
            if (!(otherspec.GetType() == typeof(MandolinSpec)))
            {
                return(false);
            }

            MandolinSpec spec = (MandolinSpec)otherspec;

            if (!_style.Equals(spec._style))
            {
                return(false);
            }
            return(true);
        }