Exemplo n.º 1
0
        public ArrayList Search(GuitarSpec searchGuitar)
        {
            ArrayList matchingGuitar = new ArrayList();

            foreach (var instrument in _inventory)
            {
                Guitar guitar = (Guitar)instrument;
                if (guitar.Spec.Matches(searchGuitar))
                {
                    matchingGuitar.Add(guitar);
                }
            }
            return(matchingGuitar);
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
 public Guitar(string serialNumber, double price, GuitarSpec spec) : base(serialNumber, price, spec)
 {
 }