摘要: 1 var Pet = function(name, legs){ 2 this.name = name; 3 this.legs = legs; 4 }; 5 Pet.prototype.getDetails = function(){ 6 return this.name + " has " + this.legs + " legs"; 7 }; 8 9 var Cat = function(name){10 Pet.call(this, name, 4);// Call the parent object's constructor11 } 阅读全文
posted @ 2013-12-07 17:17 楚玉 阅读(209) 评论(0) 推荐(0) 编辑