====== Object Oriented Javascript ======
===== Example Class =====
function OOClass()
{ this.local_public = "public";
var local_private = "private";
this.publicTest = function()
{ console.log("privprintfunc: "+this.local_public);
}
var privTest = function()
{ console.log("privprintfunc: "+local_private);
}
}
===== Public Fields =====
this.local_public = "public";
* Public fields must be addressed with the **this.** prefix when used **within the class definition** and with the **.** prefix when used **outside of the class definition**.
===== Private Fields =====
var local_private = "private";
* Private fields must be addressed without any prefix and cannot be directly address outside of the class definition.
===== Public method =====
this.publicTest = function()
{ console.log("privprintfunc: "+this.local_public);
}
var publicTest = this.publicTest;
===== Private Method =====
var privTest = function()
{ console.log("privprintfunc: "+local_private);
}