我在ExtJS 论坛上对扩展类中的私有方法和字段进行了一些研究,但我找不到任何真正的答案。
当我说扩展类时,我的意思是这样的:
Ext.ux.MyExtendedClass = Ext.extend(Ext.util.Observable, {
publicVar1: 'Variable visible from outside this class',
constructor: function(config) { this.addEvents("fired"); this.listeners = config.listeners; }, // to show that I need to use the base class
publicMethod1: function() { return 'Method which can be called form everywhere'; },
publicMethod2: function() { return this.publicMethod1() + ' and ' + this.publicVar1; } // to show how to access the members from inside another member
});
这里的问题是一切都是公开的。那么,如何在MyExtendedClass范围内添加一个无法从外部访问但可以通过公共方法访问的新变量 o 方法?