js 继承 实例图示详解
2016-08-25 20:27
471 查看
</pre><pre name="code" class="javascript"><script type="text/javascript"> function Animal(name,age){ this.name = name; this.age = age; this.action = function(){ console.log('animal action'); } } Animal.prototype.sleep = function(){ console.log('animal sleep'); } Animal.prototype.eat = function(){ console.log('animal eat'); } function Bird(name){ this.name = name; } Bird.prototype = new Animal('animalname',0); Bird.prototype.constructor = Bird; var birdObject = new Bird('乌鸦'); </script>
相关文章推荐
- js原型继承机制实例详解
- js原型继承机制实例详解
- js继承实例
- JS原型继承实例
- js中对prototype对象继承的一个实例
- Swift难点-继承中的构造规则实例详解
- java类继承中的构造方法实例详解
- JS 继承实例分析
- js实例属性和原型属性示例详解
- js的2种继承方式详解
- js showModalDialog弹出窗口实例详解
- javascript继承机制实例详解
- js继承实例
- 详解Node.js API系列C/C++ Addons(3) 程序实例
- JS Pro-深入面向对象的程序设计之继承的详解
- js的2种继承方式详解
- [原创] JS 继承详解。欢迎拍砖
- JS Pro-深入面向对象的程序设计之继承的详解
- 详解Node.js API系列C/C++ Addons(3) 程序实例
- java 基础之继承详解实例