87,992
社区成员
发帖
与我相关
我的任务
分享
//父类
function Father(name){
this.name = name;
}
Father.prototype.say =function(){
alert(this.name);
}
//子类
function Child(name){
//继承父类的属性
Father.call(this,name);
}
//类A不是只有一个有参数的构造方法吗?怎么可以使用使用无参的?
Child.prototype = new Father();
var b = new Child("苍小姐");
b.say();
