} // AddWife /// <summary> /// Divorces a wife from this man /// </summary> /// <param name="wife">The wife to be divorced</param> // Pre: (wife != null) and (this.hasMarried(wife)) public void RemoveWife(Woman wife) { wifes.Remove(wife); if (wife.HasMarried(this)) { wife.RemoveHusband(this); } // if } // RemoveWife
} // Man /// <summary> /// Adds a new wife to the man's harem /// </summary> /// <param name="wife">The new wife for this lucky man</param> // Pre: wife != null public void AddWife(Woman wife) { wifes.Add(wife); if (!wife.HasMarried(this)) { wife.AddHusband(this); } // if } // AddWife