/*--------------(1)---------------*/
function A(){
this.display = function(){
alert("A display");
}
}
function B(){
this.show = function(){
alert("B show");
}
}
A.prototype = new B();
var a = new A();
console.log(a);
a.display();//弹出 A display
a.show();//弹出 B show
/*--------------(2)---------------*/
function _A(){
this.display = function(){
alert("_A display");
}
}
var _B = function(){
this.show = function(){
alert("_B show");
}
}
_A.prototype.show = _B;
var _a = new _A();
console.log(_a);
_a.display();//弹出 _A display
_a.show();//该语句不弹出alert
/*上面的(1)和(2)有什么区别,为什么_A含有show方法,但是_a对象执行_a.show()却不会弹出alert?谁能帮忙解答一下,非常感谢!*/