You have to pass $super to the subclass' methods as its first argument
and then call it from there.

var Cat = Class.create(Animal, {
 initialize: function($super, name) {
   $super(name);
   alert('Cat : initialize');
 }
});

Best,
-Nicolas

On 9/20/07, Nicolás Sanguinetti <[EMAIL PROTECTED]> wrote:
> You have to pass $super to the subclass' methods as its first argument
> and then call it from there.
>
> var Cat = Class.create(Animal, {
>   initialize: function($super, name) {
>     $super(name);
>     alert('Cat : initialize');
>   }
> });
>
> Best,
> -Nicolas
>
> On 9/20/07, Les <[EMAIL PROTECTED]> wrote:
> >
> > I'm using Prototype 1.6 RC0.  I don't see that the superclass
> > constructor is called automatically.  They should always  be called
> > automatically, and always before the subclass constructor.  Do I have
> > to invoke the superclass constructor myself?
> >
> > See the code below:
> >
> > var Animal = Class.create({
> >   initialize: function(name) {
> >     alert('Animal: initialize');
> >     this.name = name;
> >   },
> > });
> >
> > // subclass that augments a method
> > var Cat = Class.create(Animal, {
> >   initialize: function(name) {
> >     alert('Cat : initialize');
> >   },
> > });
> >
> > var cat = new Cat('test');
> >
> >
> > > >
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype: Core" group.
To post to this group, send email to prototype-core@googlegroups.com
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