//採用call方式實作js
繼承繼承權) {
this.Acolor = 顏色;
this.AshowColor = function() {
document.writeln("Acolor: " this.Acolor);
}
}
函數B(顏色, 名稱) {
A.call(this, 顏色);
this.Bname = 名稱;
this.BshowName = function() {
document. writeln("Bname: " this.Bname);
}
}
var objA = new A("red");
objA.AshowColor();
document. writeln("----------------");
var objB = new B("黑色", "演示");
objB.AshowColor();
objB.BshowName();
document.writeln("----------------");