Hi,

depends on how many times you need this...
but I think I'll try to do something like this:
//just as example! =P
var Star = new Class({
    draw: function(argument){
 switch (argument) {
case undefined:
this._draw_overloaded_2(argument);
 break;
default:
this._draw_overloaded_1();
 }
},
_draw_overloaded_1: function() {
        return 'borderd star!';
    },
    _draw_overloaded_2: function(extra){
        return 'filled star' + extra;
    }
});




On Thu, Mar 10, 2011 at 12:01, 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