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); }
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); }
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); }