I'm interested in your opinions on how I'm handling getters and
setters in classes. Can you see any problems with my approach and what
trouble might I be getting myself into?
The huge body of my programming work has been with ASP.NET in VB and
C#. So I'm used to classic OOP rather than prototype inheritance. With
that in mind, I'm trying to semi-replicate getters and setters
thus ...
----------------------------------------------------------
this.property = function(value){
if(arguments.length == 0){
return localVariable;
}else{
localVariable = value;
}
}
----------------------------------------------------------
So if no arguments are passed, the function becomes a getter or a
setter if there are arguments.
What do you think?
--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---