Various casting methods in ActionScript 3

What's the difference between:

Car(someObject).isRacing; 

and

 (someObject as Car).isRacing; 
+4
source share
2 answers

Here is an earlier topic on the same topic, you will find many details there.

Link

+3
source

Casting using Car(someObject) will Car(someObject) error if someObject is not of type Car or does not extend Car, while someObject as Car will simply return null if any object is not of type Car or extends Car.

+7
source

Source: https://habr.com/ru/post/1286778/


All Articles