KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
From what I understand of ActionScript, there are two kinds of casts: var bar0:Bar = someObj as Bar; // "as" casting var bar1:Bar = Bar(someObj); // "class name" casting (for want of a better name) Also, and please correct me if I'm wrong here, as casting will either return an instance of the class or null , while "class name" casting will either return an instance of the class or raise an exception if the cast is impossible – other than this, they are identical. Given this, though, as casting seems to be a massive violation of the fail-fast-fail-early principle... And I'm having trouble imagining a situation where it would be preferable to use an as cast rather than a class name cast (with, possibly, an instanceof thrown in there). So, my question is: under what circumstances would it be preferable to use as casting?
Tags (comma-separated)
Save Edits
Cancel