function Cat(){ this.eat = '肉'; }
function Tiger(){ this.color = '黑黄相间'; }
function Cheetah(){ this.color = '报文'; }
function Lion(){ this.color = '土黄色'; }
Tiger.prototype = Cheetah.prototype = Lion.prototype = new Cat();
var T = new Tiger(); var C = new Cheetah(); var L = new Lion();
console.log(T.color); console.log(C.color); console.log(L.color);
console.log(T.eat); console.log(C.eat); console.log(L.eat);
|