The BuyNow object is a subclass of the Bid object in the Bid example
Once can easily call bidder.getBids() to obtain all the bids for that bidder, but how would one view JUST the bids that were made using the "BuyNow" feature?
My only idea on how to do this is to iterate through the collection (returned by getBids) and doing an instanceof on each of the "Bids" to see if it is a BuyNow class. I haven't tested to see if this works or not.
I was wondering if someone else would have a better approach to this problem.
I am using subclasses for 4 different subclasses, and need to tell them apart programmatically so that I can cast them and do my java magic.
Thanks.
Phillip
|