public override bool matches(InstrumentSpec otherSpec) { if (!base.matches (otherSpec)) return false; if (!(otherSpec is GuitarSpec)) return false; GuitarSpec guitarSpec = otherSpec as GuitarSpec; if (this.NumStrings != guitarSpec.NumStrings) return false; return true; }
public void addInstrument(string serialNumber, double price, InstrumentSpec spec) { Instrument instrument = null; if (spec is GuitarSpec) { instrument = new Guitar (serialNumber, price, spec as GuitarSpec); } else if (spec is MandolinSpec) { instrument = new Mandolin (serialNumber, price, spec as MandolinSpec); } inventory.Add (instrument); }
public virtual bool matches(InstrumentSpec otherSpec) { if (this.Builder != otherSpec.Builder) return false; if ((this.Model != null) && (!model.Equals ("")) && (!this.Model.Equals (otherSpec.Model))) return false; if (this.Typeg != otherSpec.Typeg) return false; if (this.BackWood != otherSpec.BackWood) return false; if (this.TopWood != otherSpec.TopWood) return false; return true; }
public Instrument(String serialNumber, double price, InstrumentSpec spec) { this.serialNumber = serialNumber; this.price = price; this.spec = spec; }