//采用call方式实现js继承
fonction A (couleur ) {
this.Acolor = couleur;
this.AshowColor = function() {
document.writeln("Acolor: " this.Acolor);
}
}
function B(couleur, nom) {
A.call(this, couleur);
this.Bname = nom;
this.BshowName = function() {
document.writeln("Bname: " this.Bname);
}
}
var objA = new A("rouge");
objA.AshowColor();
document.writeln("----------------");
var objB = new B("black", "demo");
objB.AshowColor();
objB.BshowName();
document.writeln("----------------");