function Person(name,sex){
this.name=name;
this.sex=sex;
}
Person.prototype={
getName:function(){
return this.name;
},
getSex:function(){
return this.sex;
}
};
function Employee(employeeId){
this.employeeId=employeeId;
}
Employee.prototype=new Person(“李四”,”男”);
var employee = new Employee(2);
//修改Employee的构造器
Employee.prototyoe.constructor=Employee;
js对象的继承
最新推荐文章于 2023-05-12 16:47:31 发布