public override bool Equals(Object o) { if (null == o || !(o is XYLocation)) { return base.Equals(o); } XYLocation anotherLoc = (XYLocation)o; return ((anotherLoc.getXCoOrdinate() == xCoOrdinate) && (anotherLoc .getYCoOrdinate() == yCoOrdinate)); }