//通过原型继承
function Animal(){
this.loveAttr=function(){
console.log('我爱吃鱼')
}
}
Animal.prototype.showAttr=function(){console.log('我非常可爱')};
function Cat(name){
this.name=name;
}
Cat.prototype=new Animal();
Cat.prototype.showName=function(){console.log('我的名字是:'+this.name)}
var c=new Cat('猫');
c.showName();
c.showAttr();
c.loveAttr();