function Base(name){
this.name = name;
this.getName = function(){
return this.name;
}
}
function Child(id){
this.id = id;
this.getId = function(){
return this.id;
}
}
Child.prototype = new Base('base');
var ch = new Chilc('child');
alert(ch.getId());
alert(ch.getName());
JS继承
最新推荐文章于 2024-06-14 14:37:58 发布