js 继承(3 使用prototype.js)
来源:互联网 发布:mac地址是唯一的吗 编辑:程序博客网 时间:2024/05/17 21:07
var Class = {
create:function(){
return function(){
this.initialize.apply(this,arguments);
}
}
}
//destination 子对象
//source 父对象
Object.extend = function(destination,source){
for(property in source){
destination[property] = source[property];
}
return destination;
}
var Person = Class.create();
Object.extend(Person.prototype,{
initialize:function(name){
this.name = name;
},
getName:function(){
return this.name;
}
});
var User = Class.create();
//等价于:
//var User = fucntion(){
// this.initialize.apply(this,arguments);
// }
User.prototype = Object.extend(new Person(),{
initialize:function(name,password){
this.name = name;
this.password = password;
},
getPassword:function(){
return this.password;
}
});
var u = new User('xiaobai','123');
alert(u.getPassword());
alert(u.getName());
- js 继承(3 使用prototype.js)
- js 继承(2 使用prototype.js)
- js 继承【 原型(prototype)】
- JS 伪继承 prototype
- JS prototype 继承
- js 原型继承 Prototype
- js继承机制(Prototype.js)
- js 采用prototype实现继承
- js prototype 原型继承问题
- js中用prototype实现继承
- 借鉴prototype.js实现继承
- JS prototype的使用
- prototype.js使用详解
- js prototype使用要点
- js prototype的使用
- 解析JS的prototype继承机制
- js中prototype的继承和扩展
- js综合能力提升 继承prototype
- c 语言调用汇编堆栈的详细分析
- C文件操作函数
- bcastr.swf 制作类似csdn,flash 通用图片轮换播放器
- nginx下的图片,loader无法读取bytesTotal的问题
- up_qdgjj_cs.client.dll
- js 继承(3 使用prototype.js)
- What is the program?
- windows 下怎样利用NET-SNMP 发送和接收trap
- 光照贴图生成中的精度问题
- 输出1000以内的素数的算法
- C++ public protected private
- 【API】MmMapLockedPagesSpecifyCache
- windows上文件传到Linux
- Qt 4程序中的new和delete-兼回答网友提问