欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

prototype class詳解

 更新時(shí)間:2006年09月07日 00:00:00   作者:  
//香水壞壞 06-07-19 TKS:林子,給大家提供一個(gè)交流分享的地方
var Class = {
  create: function() {
    return function() {
      this.initialize.apply(this, arguments);
    }
  }
}
可以改寫如下:可能會(huì)看的更明了:
var Class={
    create:function(){
      return cls_initfunc
  }
}

var cls_initfunc = function()
{
    this.initialize.apply( this,arguments );  
}

//如上Class對(duì)象的create方法顯然返回的是一個(gè)對(duì)象構(gòu)建函數(shù)
//同時(shí)在構(gòu)件函數(shù)里執(zhí)行this.apply方法初始化對(duì)象
//this參數(shù)是用來(lái)替換的對(duì)象,arguments是initialize函數(shù)接受的參數(shù),通過(guò)執(zhí)行      

//下面,我給出更簡(jiǎn)單的模型
var obj = function()
{
   this.initialize.apply(this, arguments);
}
obj.prototype={
initialize:function(){
  //do ur init in here
},
<field>,
<menthod>
}

相關(guān)文章

最新評(píng)論