class instance interface abstract-class extends implements private protected public static const constructor super read-only friendly-method event |
ConstructorZNOW determine "init" as a constructor. The only reason why it is not "constructor" is "init" is shorter. It can reduce the coding work. A constructor can be private, protected or public. Private constructor is especially important in creating singleton. var ClassA=Class({
'static.getNewInstance':function(){
// private constructor can be accessed in static methods
return new ClassA();
},
_init:function(){
// A private constructor
}
});
|