JS 继承实例分析
2008-11-04 00:00
661 查看
function P(name){ this.name=name; this.p1=function(){ alert('Parent Constructor'); } return this; } function C(name,id){ //this.method=P; //this.method(name); //1st method //P.call(this,name); //2nd method P.apply(this,new Array(name));//3rd method this.id=id; this.dis=function(){ alert(this.name); } } function dis(){ alert(this.name); } function t(){ var cc=new C('N','Id'); cc.dis(); cc.p1(); }
相关文章推荐
- JS继承用法实例分析
- JS继承用法实例分析
- js原生继承之——类式继承实例(推荐使用)
- JS函数this的用法实例分析
- JS实现字符串转日期并比较大小实例分析
- JS获取鼠标坐标位置实例分析
- JS建造者模式基本用法实例分析
- js正则表达式中的单行模式与多行模式实例分析
- JS常用的几种数组遍历方式以及性能分析对比实例详解
- 一个JS内存泄露实例分析
- Python中的单继承与多继承实例分析
- js封装可使用的构造函数继承用法分析
- JS解析XML实例分析
- js中的scroll和offset 使用比较的实例与分析
- C#中事件的继承实例分析
- JS提交form表单实例分析
- JS继承(inheritance)的几种方式分析
- JS鼠标拖拽实例分析
- js中this的用法实例分析