[转]js 重写继承方法
来源:互联网 发布:苹果数据大师破解版 编辑:程序博客网 时间:2024/06/05 00:47
- // supcalss
- var parent = function(name,age){
- this.name = name;
- this.age = age;
- }
-
- parent.prototype.showProper = function()
- {
- console.log(this.name+":"+this.age);
- }
-
- var child = function(name,age){
- parent.call(this,name,age);
- }
-
- // inheritance
- child.prototype = Object.create(parent.prototype);
- // child.prototype = new parent();
- child.prototype.constructor = child;
-
- // rewrite function
- child.prototype.showProper = function(){
- console.log('I am '+this.name+":"+this.age);
- }
-
- var obj = new child('wozien','22');
- obj.showProper();
1 0
- [转]js 重写继承方法
- js继承中的方法重写
- JS 继承与重写
- 继承&&方法重写
- 继承·方法重写
- 继承中的方法重写
- 继承中的方法重写
- 继承及其方法重写
- js中的继承与重写
- 转: Objective-c 类的继承 方法重写 方法重载
- 静态方法隐藏、重写、继承
- 继承_方法的重写
- java 继承中的方法重写
- javascript封装,继承,方法重写
- 10.方法重载,重写,继承
- 创建继承和方法重写
- js重写方法
- js重写方法
- Dijkstra算法和A*算法试验对比
- JAVA求指定素数合
- 关于Fedora 24 的 `dnf update`这个小故障
- 《Unity Shader 与 计算机图形学》第二章
- 纳什均衡
- [转]js 重写继承方法
- [51nod1375]再选数
- USACO2014MarchGold Counting Friends
- runtime解决button重复点击的bug
- Git的简单使用
- 积攒力量,继续折腾(16年年终总结)
- Android真机测试,连接到本地服务器的方法
- 在VMware中CentOS6.8的安装
- sql server 游标使用的一个坑