Oh boy... what happened to the principle of least surprise? :)
I can invoke the superclass constructor by adding this line:
Animal.prototype.initialize.apply(arguments);
But, shouldn't have to do this or use $super(name). The superclass
constructor should be called automatically (as in Dojo for example).
See the complete 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) {
Animal.prototype.initialize.apply(arguments);
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
-~--~~~~--~~--~--~---