javascript继承
来源:互联网 发布:手持数据终端i6200s 编辑:程序博客网 时间:2024/05/22 14:00
<script> function Person(first,last) { this.first = first; this.last = last; }; Person.prototype = { fullName:function () { return this.last+'.'+this.first; } }; function Student(first,last,id) { Person.call(this,first,last); //call是function才有的 所以Person.prototype.call(this,first,last); 是不行的 也就是说call不能指向Person 的 prototype this.id = id; }; Student.prototype = new Person();// Student.prototype = {// getid:function () {// return this.id;// }// }; //如果这样写就会有问题 Student.prototype.getid = function () { return this.id; }; var dinwan = new Student("din","wan","21"); alert(dinwan.fullName()); alert(dinwan.getid());</script>
0 0
- javascript继承
- javascript继承
- javascript 继承
- Javascript继承
- Javascript继承
- javascript继承
- Javascript继承
- javascript继承
- JavaScript 继承
- javascript 继承
- JavaScript 继承
- javascript 继承
- javascript 继承
- Javascript继承
- Javascript继承
- Javascript 继承
- JavaScript 继承
- javascript继承
- java实现找出所有的最大连通子图,并把连通子图中所有顶点的集合合并为一个i额字符串集合。
- php安装模块
- 在eclipse中代码提示出来后点击回车,为什么会在类名或者接口名前面自动加上包名!
- 【2016 泉市教科】密码锁
- calendar模块用法
- javascript继承
- SAX方式解析XML文件
- cocoapods集成依赖库去警告
- 【微信小程序】:开发之前要知道的三件事
- Accelerated Gradient Method for Multi-Task Sparse Learning Problem[2009]
- 2016.11.12【初中部 NOIP普及组 】模拟赛
- Dojo1.11官方教程文档翻译(2.3)AMD使用进阶
- 【Spring】Spring常用配置-Bean的初始化和销毁(生命周期)
- Github fork同步