JavaScript一个继承类的例子
2017-02-24 18:07
393 查看
function Animal(name) { this.name = name || "xxx"; this.type = "animal"; } Animal.prototype = { say : function(){ alert("I'm a " + this.type + ", my name is " + this.name) } } function Bird(name) { Animal.call(this, name); } Bird.prototype={ } var myBird = new Bird("xiaocui"); alert(myBird.type);
相关文章推荐
- Javascript 进阶 面向对象编程 继承的一个例子
- 【自】JavaScript面向对象初探二:通过编写一个拖拽例子,让我们了解对象的继承
- Javascript 进阶 面向对象编程 继承的一个例子
- 一个javascript继承和使用的例子
- 关于合成模式的javascript的一个treeview例子
- javascript 调用webservice的一个例子
- 第一次用javascript写了一个不用刷新就能实现--用户名验证的例子
- 一个JavaScript继承的实现
- 一个JavaScript继承的实现
- 关于继承和多态的一个简单例子
- Ajax - JavaScript之实现私有属性、像C++和Java一样支持基于类的继承方法之例子
- 以一个最简单的例子把OO的JavaScript说明白
- 一个例子对于类继承和关键字“this”的理解
- JavaScript学习笔记8--一个文字自动匹配的例子
- 以一个最简单的例子把OO的JavaScript说明白
- 一个JavaScript缩略图的小例子
- 用一个最简单的例子把OO的JavaScript说明白
- 入门1--结合javascript制作一个简单的silverlight1.0例子
- 暂寄一个Javascript去除左右空格的例子,不用浪费时间每次都写.
- JavaScript学习笔记8--一个文字自动匹配的例子