3 ms·
I get the point being made, but the rules probably shouldn't be directly associated with the Item objects in the first place. How would you apply a pricing rule
by nitwit005 11y ago
I get the point being made, but the rules probably shouldn't be directly associated with the Item objects in the first place. How would you apply a pricing rule like: "Free shipping if item total is > $20 after discounts applied"?
The general approach I've seen to this sort of thing is to create a stack of rules, and each rule applies its changes if needed. And for that, an array of function pointers will work fine.