function A(){ // just like component
alert('A constructor');
this.initComponent();
}
A.prototype = {
constructor : A,
initComponent : function() {
alert('a initComponent');
}
}
// var a = new A();
B = Ext.extend(A, { // just like window
initComponent : function() {
alert('b initcomponent');
B.superclass.initComponent.call(this);
}
});
b = new B();
B是A的子类了,new B()的时候为什么A函数会被调用到了。在java里面子类的构造函数里面调用super()倒是一个默认规定。
但是javascript,感觉肯定有个地方显示调用了,但是我找了很久没找到。
如果能指出是在Ext.extend的哪行源码最好了。
谢谢。