For some more insights (though ... not much .. .and hey baby, is that Java over 
there ?) you can check this thread (they are speaking about private and 
protected classes, but the reading is interesting)
<http://www.coderanch.com/t/410134/java/java/private-protected-class>

hth,
Cedric

> Why? The answer has to do with Adobe's adherence to the ECMAScript working 
> standard that they were basing AS3 on. At the time (before the ECMAScript 4 
> process fell apart), the body determined that private constructors were not 
> needed, so adobe built this restriction into AS3.
> 
> Private constructors aren't useless, particularly for single pattern. With a 
> private constructor, you can instantiate the class from within itself, assign 
> it to a private class (static) property, and then expose the single instance 
> through a public class (static) getter function. You'd be protected from 
> every other way to instantiate the class. There are ways to do singleton 
> without it, they are just more of a pain. Like taking an instance of a key 
> class in the constructor, where the Key class is defined in the local class 
> file scope chain. Since nothing else will have access to that Key class 
> except your singleton class, you can use that as a nice locking mechanism.
> 
> I can't think of any use for private class off the top of my head, but that 
> doesn't mean there isn't one.
> 
> Kevin N.
> 
> 
> On 5/21/13 2:39 AM, Cor wrote:
>> Karl,
>> 
>> One: why doesn't ActionScript 3 allow private classes?
>> A: They are useless because they couldn't be used, I guess.
>> You can use a Class within a public class which then would be private to
>> that class it self.
>> 
>> Two: why is writing "public class" a best practice if "private class" does
>> not exist?
>> Look a the variations with static etc.
>> 
>> HTH
>> Cor
>> 
>> 
>> 
>> 
>> _______________________________________________
>> Flashcoders mailing list
>> Flashcoders@chattyfig.figleaf.com
>> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> 
> _______________________________________________
> Flashcoders mailing list
> Flashcoders@chattyfig.figleaf.com
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to