Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

Re: Inheritance: the root of the problem

by xmath (Hermit)
on Aug 04, 2006 at 16:58 UTC ( #565703=note: print w/replies, xml ) Need Help??

in reply to Inheritance: the root of the problem

Inheritance typically accomplishes two things:

1. interface inheritance, saying you support every operation that your super supports. This is probably better accomplished with interfaces, either explicit (like Java) or implicit (does it support these methods? good enough.)

2. implementation inheritance, reusing the parent's implementation of various stuff because the same applies to you. This is can be done via delegation, where you create the parent object, and "merge" some or all of its methods into the "subclass" object you're creating. If there's a need for the parent to call into the child, then appropriate closures should be passed upwards during construction.

Making a nice syntax for all this is probably the biggest challenge :-)

UPDATE: You might also want to look at how the E programming language, which does closure-based OO, handles delegation.

  • Comment on Re: Inheritance: the root of the problem

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://565703]
[Discipulus]: well i'm still at the end of the food chain..
[Discipulus]: so a new life as krill in prague will be good
[erix]: wtf -- what's the idea, is this trolling, advertising, or what?
[Discipulus]: but realisticly choroba your company would a hire a programmer as me?
Discipulus spent ~3 hours on the roof.. with mediocre results..
[Eily]: what were you trying to do on the roof Discipulus?

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (9)
As of 2017-06-29 12:52 GMT
Find Nodes?
    Voting Booth?
    How many monitors do you use while coding?

    Results (663 votes). Check out past polls.