JavaScript对象的继承方式
.原型链继承
function Student(name,age){
this.name = name;
this.age = age;
}
Student.prototype.study = function () {
console.log("Fd");
}
function SmallStudent(name,age){
//对象冒充继承
Student.call(this,name,age);
}
//原型链继承:
SmallStudent.prototype = new Student("web",18);