Not really, I already implemented a class hierarchy:
var TreeNode = new Class({});
var CompositeTreeNode = new Class({
Extends: TreeNode,
...
});
var LeafTreeNode = new Class({
Extends: TreeNode,
...
addChildNode: function(){
...
this.transformToComposite();
},
transformToComposite: function(){
this.implement( CompositeTreeNode );
}
});
What I'd like to do is to change the type / Class of an already
existing object. I guess (I'll make a try now), I could use something
like this:
http://devedge-temp.mozilla.org/toolbox/examples/2003/inheritFrom/inheritFrom.js
thought I'm looking for a more Mootools way.
-Zsolt
On márc. 16, 20:21, Matthew Hazlett <[email protected]> wrote:
> Sound like you want to 'Extends' the class.
>
> var TreeNode = new Class({
> Extends: CompositeTreeNode,
> ...
> ...
> ...
>
> });
>
> http://mootools.net/docs/core/Class/Class
>
> you can also look at
>
> http://mootools.net/docs/core/Core/Core#Type:extend