class instance interface abstract-class extends implements private protected public static const constructor super read-only friendly-method event |
ClassCreating a Class in ZNOW is as easy as creating a Json object. To avoid the reserved world "class", ZNOW use "Class" instead of "class". var Person=Class({
init:function(firstName, lastName){
this._firstName=firstName;
this._lastName=lastName;
},
toString:function(){
return "I am "+this._firstName+" "+this._lastName+".";
},
_firstName:false,
_lastName:false
});
Inside the Json object, you may declare the methods and attributes to the class. While the "init" has the meaning of constructor, ZNOW use prefix to classify whether the property is private, protected or public. Without any prefix, it is classified as public. Property started with "$" or "_" will be classified as protected or private. |