//创建一个人类
function People(name,age,sex,country){
this.name=name;
this.age=age;
this.sex=sex;
this.country=country;
}
People.prototype.eat=function(){
console.log("吃饭");
}
People.prototype.sleep=function(){
console.log("睡觉");
}
//创建一个教师类
function Teacher(name,age,sex,country,subject){
//原型链继承
this.subject=subject;
}
Teacher.prototype=new People("张三",30,"男","中国");
var teacher1=new Teacher("玉小刚",29,"男","蓝电霸王龙","理论");
console.log(teacher1);