欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

采用call方式實(shí)現(xiàn)js繼承

 更新時(shí)間:2014年05月20日 17:45:43   作者:  
這篇文章主要介紹了如何采用call方式實(shí)現(xiàn)js繼承,需要的朋友可以參考下
復(fù)制代碼 代碼如下:

//采用call方式實(shí)現(xiàn)js繼承
function A(color) {
this.Acolor = color;
this.AshowColor = function() {
document.writeln("Acolor: " + this.Acolor);
}
}

function B(color, name) {
A.call(this, color);

this.Bname = name;
this.BshowName = function() {
document.writeln("Bname: " + this.Bname);
}
}

var objA = new A("red");
objA.AshowColor();
document.writeln("----------------");
var objB = new B("black", "demo");
objB.AshowColor();
objB.BshowName();
document.writeln("----------------");

相關(guān)文章

最新評(píng)論