Joined: Sun Mar 27, 2005 1:22 pm Posts: 15
|
Looking for advice on this and it's best if I present an example to explain...
I have a ShoppingCart object that holds many Items.
The item object has a flag isPerishable
When I get the object ShoppingCart I would like to know how many Item objects it holds are of type isPerishable, the only way I know how to do that it is to add a howManyIsPerishable() method to the ShoppingCart object and loop over the Items and count on the isPerishable flag.
Is there a more intelligent way of doing this?
Thanks
|
|