La copie de code est la suivante:
// Utiliser la méthode d'appel pour implémenter l'héritage JS
fonction a (couleur) {
this.acolor = couleur;
this.AshowColor = function () {
Document.Writeln ("Acolor:" + this.acolor);
}
}
fonction b (couleur, nom) {
A.Call (ceci, couleur);
this.bname = name;
this.bshowname = function () {
Document.Writeln ("bname:" + this.bname);
}
}
var obja = new a ("rouge");
obja.AshowColor ();
document.writeln ("----------------------------------------------------------------------------------------------------------------------
var objb = new b ("noir", "démo");
objb.AshowColor ();
objb.bshowname ();
document.writeln ("----------------------------------------------------------------------------------------------------------------------