Hong Zhang wrote:
> 
> Say if you want Thread can be easily inserted into LinkedList,
> you can write
> 
> public Thread extends Object implements Node {
>   ...
> }
> 
> or
> 
> public Thread extends Object, Node {
>   ...
> }
> 
> and don't bother to implement classic linked list node.
> 
> Hong

You could use a hasa relation as well, as long as the node object
has a link to the owner.

package ListableObject;
sub new {
        my $O = new Object;
        $O->addfield(node => Node::new({Ownedby=> $O}));# or something like this
};

It would of course be easier to get wrong.

-- 
                                           David Nicol 816.235.1187
        "It's widely known that the 'F' in RTFM is silent." -- Olie

Reply via email to