I am currently writing a set of skeleton classes for an application, starting with the StoreLogic base class, which has tax rules, discount rules, etc. Classes Cart, Order, Quote, etc. will extend StoreLogic as they will all use the same set of methods that StoreLogic supports.
As soon as these main classes are completed, I will implement them by expanding Cart, Order, Quote AND StoreLogic, since each application of these classes will differ depending on the needs of different clients. Redefining methods from parent classes is easy, but redefining grandparents' classes before their children expanded them seems ... impossible? I have a feeling that I am doing it wrong (tm) .. and I think that someone more experienced as you might be able to point me in the right direction. Take a look at the code and see what you think!
abstract class StoreLogic { public function applyDiscount($total) { return $total - 10; } } abstract class Cart extends StoreLogic { public function addItem($item_name) { echo 'added' . $item_name; } } abstract class Order extends StoreLogic {
source share