I'm trying to figure out how to correctly extened several classes without duplicate code. I have the following classes:
- Base (method A, method B)
- Invoice : Base (method C)
- Shipment : Base (Method D)
I have to adjust some functionality without modifying them. The problem is that some methods I need to adjust are in the base class.
If I extend the Base class, I will need to copy Methods C and D. If I extend each of the final classes, then I need to duplicate the changes to methods A, B.
How do I correctly do this without multi-inheritance (PHP, not possible) or duplicate code?