public bool Equals(AbstractFurniture that) { if ((object)that == null) { return false; } if (that.fancyName.Equals(this.fancyName) && that.room == this.room && that.material == this.material && that.size.Equals(this.size) && that.price == this.price) { return true; } return false; }
public void addFurniture(AbstractFurniture furniture, Int32 count) { if (!this.items.ContainsKey(furniture)) { this.items.Add(furniture, count); } else { Int32 prevCount = this.items[furniture]; this.items[furniture] = prevCount + count; // or: this.items[furniture] += prevCount + count; } }
private static void sellFurniture(AbstractFurniture furniture, int pieces ) { Console.WriteLine(furniture.sell(pieces)); }