Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

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?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://565703]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (3)
As of 2014-07-30 22:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (241 votes), past polls