On 9/28/07, Yanick <[EMAIL PROTECTED]> wrote:
>
>
> var Class2 = Class.create(Class1, {
>   ...
>   foo: function($super, n) {
>     return $super() * n;
>   }
> };


new Class2().foo(2) //-> 202

You can use $super in any method, not just initialize. The public method of
"foo" still takes only 1 argument ("n") regardless of its declaration where
$super is pushed in the front. (This is a bit magical.) The special word
$super is just an implementation detail required in case you need a
reference to the overriden method.

I have a Prototype OOP tutorial ready, I just didn't publish it because
we're still deciding about the API of additional methods other than
Class.create.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype: Core" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to