Star.implement('draw', function(){ /*new code here */ });

If you want to save old method, use Class.refactor from MooTools More:
Class.refactor(Star, {
    draw: function(){
        /* new code here */
        this.previous(); // old draw method
        /* new code here */
    }
});

or just save old method:
var old = Star.prototype.draw;
Star.implement('draw', function(){
    /*new code here */
    old.apply(this);
    /* new code here */
});

On Thu, Mar 10, 2011 at 1:01 PM, remram <[email protected]> wrote:
> Hi everybody,
> I searched the web for a solution for my problem but I'm still
> unsuccessful. What I would like to do, is to do overloading my methods
> in my class (in my case draw). I have no idea if it is possible to do
> that with MooTools (version 1.2.4).
> Please have a look at my code below.
> Thank you in advanced for any hint or help.
>
> var Star = new Class({
>
>    draw: function(){
>        return 'borderd star!';
>    },
>
>    draw: function(extra){
>        return 'filled star' + extra;
>    }
> });

Reply via email to