in reply to Re: Real live usage of inheritance?
in thread Real live usage of inheritance?

Perhaps the most obvious use is laziness - why bother maintaining X methods across Y classes, when you can just have your subclasses inherit from your main class and maintain the non-overriden methods there . . .

Eek! Such is really false-laziness, as it tends to break object relationships into whatever the programmer felt like at the time, instad of a logical flow. It tends to make things a lot harder over time, since two classes that really have nothing to do with each other are suddenly in a parent-child relationship, just because there was a bit of code in the parent that was also needed in the child.

Down that path lies many a broken OO project.

----
I wanted to explore how Perl's closures can be manipulated, and ended up creating an object system by accident.
-- Schemer

: () { :|:& };:

Note: All code is untested, unless otherwise stated

Replies are listed 'Best First'.
Re: Re: Re: Real live usage of inheritance?
by broquaint (Abbot) on Nov 06, 2003 at 00:05 UTC
    Eek! Such is really false-laziness ... since two classes that really have nothing to do with each other are suddenly in a parent-child relationship
    Er ... perhaps. But I meant to imply without inheritence, it's rather more difficult to maintain related modules, not to inherit just because of a common method. So in conclusion, inheritence is powerful, but has its dangers, like most useful programming constructs.
    HTH

    _________
    broquaint