On May 12, 8:26 am, louis w <louiswa...@gmail.com> wrote:
> Josh could you post an example of how you do it? I am interested in
> all of the different approaches.
> Thanks.

Douglas Crockford explains how to create private and privileged
members in javascript:

<URL: http://www.crockford.com/javascript/private.html >

which has morphed into the module pattern:

<URL: http://ajaxian.com/archives/a-javascript-module-pattern >

For inheritance, there is also Crockford's "beget" function (a version
of Lasse Reichstein Nielsen's "object clone" function):

<URL: http://javascript.crockford.com/prototypal.html >

It is common for developers coming to javascript to try and emulate
classes, however after a while, they realse plain objects to the job
with greater simplicity and clarity, without the obfuscation of class
emulation.  As Crockford says:

"I have learned to fully embrace prototypalism, and have liberated
myself from the confines of the classical [class inheritance] model"

Javascript can emulate many object models, not just classic OO or
class-based iheritance.


--
Rob
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to