public void AddInstrument(String serialNumber, double price, InstrumentSpec spec) { Instrument instrument = null; if (spec is GuitarSpec) { instrument = new Guitar(serialNumber, price, (GuitarSpec)spec); } else if (spec is MandolinSpec) { instrument = new Mandolin(serialNumber, price, (MandolinSpec)spec); } _inventory.Add(instrument); }
public bool Matches(InstrumentSpec otherSpec) { if (!base.Matches(otherSpec)) { return(false); } if (!(otherSpec is MandolinSpec)) { return(false); } MandolinSpec mandolinSpec = (MandolinSpec)otherSpec; if (_style != mandolinSpec._style) { return(false); } return(true); }
public bool Matches(InstrumentSpec otherSpec) { if (!base.Matches(otherSpec)) { return(false); } if (!(otherSpec is GuitarSpec)) { return(false); } GuitarSpec guitarSpec = (GuitarSpec)otherSpec; if (_numStrings != guitarSpec._numStrings) { return(false); } return(true); }
public bool Matches(InstrumentSpec otherSpec) { if (_builder != otherSpec._builder) { return(false); } if ((_model != null) && (!_model.Equals("")) && (!_model.Equals(otherSpec._model))) { return(false); } if (_type != otherSpec._type) { return(false); } if (_backWood != otherSpec._backWood) { return(false); } if (_topWood != otherSpec._topWood) { return(false); } return(true); }
public Instrument(string serialNumber, double price, InstrumentSpec spec) { _serialNumber = serialNumber; _price = price; _spec = spec; }