function People(name,age){
this.name = name;
this.age = age;
this.run = function(){
alert(this.name+'在运动');
}
}
People.prototype.sex = '男';
People.prototype.work = function(){
alert(this.name+'在工作');
}
function Person(name,age){
People.call(this,name,age){}
}
//第一种写法
Person.prototype = new People();
//第二种写法
Person.prototype = People.prototype;
var a = new Person('lisi',30);
a.run();//可以实现
a.work();//可以实现