function SuperType(surname){
this.surname= surname;
}
SuperType.prototype.saySurame = function(){
alert(this.surname);
}
function SubType(surname, lastname, gender){
SuperType.call(this,surname);
this.lastname = lastname;
this.gender = gender;
}
SubType.prototype = Object.create(SuperType.prototype); //原型链接
SubType.prototype.constructor = SubType; //修正constructor
SubType.prototype.sayLastname = function(){
alert(this.lastname);
}






网友评论