function Parent (arg1, arg2) {
alert(arg1);
this.member1 = arg1;
this.member2 = arg2;
};
Parent.prototype.update = function () {
// parent method update
};
function Child (arg1, arg2, arg3) {
Parent.call(this, arg1, arg2);
this.member3 = arg3;
};
Child.prototype = new Parent;
Child.prototype.update = function () {
// overwritten method update
};
function init () {
var childObject = new Child(false, false, false);
childObject.update();
}
結果は、次の 2 つのアラートです。
- 未定義
- 間違い
アラートが 2 回発生するのはなぜですか? すでに検索しましたが、まだ何も見つかりません + 何を検索すればよいかわかりません。
結果は「false」の 1 つのアラートになるはずですが、間違っていますか?
ありがとう!