Juan Pablo Califano wrote:
I agree with you, but I'add for the sake of completeness that, sometimes, relaxing the rules a bit becomes a necessary evil, like for instance, when doing a cast.
I have another example of where a typecast can be useful. When you really do need only BaseClass, but want to add some processing, if and only if, the object is of a specific DerivedClass.
An examples of this example would be a display list crawler. You are just outputting all the objects, you need nothing other than DisplayObject for that. However, you want to go deep, so you use the "as" operator to get a reference to a DisplayObjectContainer. If it succeeds, you recurse. If not, not a problem.
_______________________________________________ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders