The class ItemForSale represents items that have been put up for sale in an (imaginary) electronic auction house. Items can be sold in various ways (fixed price, auctions, etc.); the concrete subclasses of this class represent those different ways. This abstract class captures some of the common characteristics of all different sales.
This simple implementation does not store any seller information.
Returns the winner of the item, or the person who is currently leading the bidding, in the case of an auction that is still open. The person’s name is returned in an Option wrapper; None is returned if nobody has expressed an interest in buying the item.
Returns the winner of the item, or the person who is currently leading the bidding, in the case of an auction that is still open. The person’s name is returned in an Option wrapper; None is returned if nobody has expressed an interest in buying the item.
Determines if the item has expired, that is, if the sale has ended due to a lack of interest and without the item having been sold. How soon this happens depends on the way the item is sold.
Determines if the item has expired, that is, if the sale has ended due to a lack of interest and without the item having been sold. How soon this happens depends on the way the item is sold.
Returns the current price of the item, that is, the price that the item is selling for at the moment. If the item is not open, the sale price (if bought) or closing price (if expired) is returned.
Returns the current price of the item, that is, the price that the item is selling for at the moment. If the item is not open, the sale price (if bought) or closing price (if expired) is returned.