4#4
In such a case we need two methods in the LotterySimulation
class, say drawLottery() and drawGraphical(). Without
language support for multiple inheritance, however, dynamic binding does
not know that it should select the drawLottery() method for an
invocation of draw() on a variable of type Lottery and
the drawGraphical() method for an invocation of draw()
on a variable of type GraphicalObject.
Implementation of such context-dependent behavior without language support results in convoluted, impractical designs. This is problematic because it leaves us only with the choice to give up substitutability of a child class instance for a parent class instance (by not declaring the implements relation). As a consequence, child classes cannot override methods in the respective parent classes because the simulation of overriding depends on substitutability of child instances for parent class instances.
5#5
An example showing that much better results can be achieved with suitable language support is shown in Section .