costructor extend

//=============jsp======
	Ext.onReady(function(){	
		
		Ext.yangchunzhi.HumanBeing.Money("www","yoyo");
	});
//===========js=========

//定义一个命名空间
Ext.namespace("Ext.yangchunzhi");

//定义一个构造器
Ext.yangchunzhi.HumanBeing =function(cfg){
	Ext.apply(this,cfg)
};



Ext.yangchunzhi.HumanBeing.Money = function(_name,_gender){
	var cfg = {name:_name,gender:_gender};
	var h = new Ext.yangchunzhi.HumanBeing(cfg);
	h.getData();
}


Ext.apply(Ext.yangchunzhi.HumanBeing.prototype,{
	getData:function(){
		alert(String.format("姓名:{0},性别:{1},大家都是:{2}",this.name,this.gender,"大腿"));	
	}
})
 

你可能感兴趣的:(function,prototype,extend,Constructor)