I am using Action Script 3, which develops data access layers for another application to another developer in my team Used to be. One of the items, making it the cost of calling user is expensive. Each user has a unique ID number, so I can tell if they have not been created before or not, and all the users objects are stored in some other place.
I want to be able to restrict it so that an ID user should be requested for the already created user .
If I was using sensibly, well prepared language I would simply make it a personal constructor and force all the requests for the object which caches things. But Flash does not allow private constructors (public and internal only, which will not work). How can I get it?
If you want to be a personal constructor, you can get it this way:
< Code> package somepackage {public class user} public function user (singleton enforcer): zero {if (s == rick) throw new exception ("sorry buddy!"); } Public stable GetUserWithId (id: string): This user has user {// user presence, then return it. // Create a new user, initialize it, cache and return}}} Singleton Explorer {// This is visible only for this class (user). }
Comments
Post a Comment