页面导航: 首页网络编程JavaScript应用技巧 → 正文内容

prototype class详解

发布:dxy 字体:[增加 减小] 类型:转载
//香水坏坏 06-07-19 TKS:林子,给大家提供一个交流分享的地方
var Class = {
create: function() {
return function() {
this.initialize.apply(this, arguments);
}
}
}
可以改写如下:可能会看的更明了:
var Class={
create:function(){
return cls_initfunc
}
}
var cls_initfunc = function()
{
this.initialize.apply( this,arguments );
}
//如上Class对象的create方法显然返回的是一个对象构建函数
//同时在构件函数里执行this.apply方法初始化对象
//this参数是用来替换的对象,arguments是initialize函数接受的参数,通过执行
//下面,我给出更简单的模型
var obj = function()
{
this.initialize.apply(this, arguments);
}
obj.prototype={
initialize:function(){
//do ur init in here
},
<field>,
<menthod>
}
浏览次数:载入中... 打印本文关闭本文返回首页
·在百度中搜索关于“prototype class详解”相关内容
·在谷歌中搜索关于“prototype class详解”相关内容

文章评论

共有 位脚本之家网友发表了评论我来说两句

同 类 文 章
最 近 更 新
热 点 排 行