in reply to Re^3: Perl OOP
in thread Perl OOP
The analogy you gave would be relevant to this discussion if it had any semblance to design by inheritance, but it doesn't.
But staying in the realm of car manufacture, we build cars by composing them out of components.Let's say you want to build (using 'inheritance') a new SmartLandRover that has additional sensors to detect when the driver is drunk, but 'inherits' other functionality from a base model Land Rover.
SmartLandRover doesn't have a battery, so it must have wires connecting it to BaseLandRover so it can get power.
SmartLandRover also doesn't have an engine, so it must have a shaft connecting it to the drive shaft of BaseLandRover so it can get movement.
This may seem ridiculous, but we do something quite similar when we use inheritance.No one designs or builds cars like that, and with good reason.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: Perl OOP
by pryrt (Abbot) on Jul 06, 2017 at 18:04 UTC |