jsは親メソッドを呼び出しjavaのsuper()をシミュレートする

389 ワード

例えば、apply、またはcallを使用してシミュレーションします.
var baseClass = cc.LayerColor.extend({
	ctor:function(){
           this._super();
	},
	destory:function(){
	   console.log("hello,world.");
	}
})

var subClass = baseClass.extend({
     ctor:function(){
	this._super();
     },

     destory:function(){
         BaseLayer.prototype.destory.apply(this,arguments);
     }
})