What is the difference between:
Car(someObject).isRacing;
and
(someObject as Car).isRacing;
Thanks in advance!
What is the difference between:
Car(someObject).isRacing;
and
(someObject as Car).isRacing;
Thanks in advance!
Casting using Car(someObject)
will throw an error if someObject is not of type Car or does not extend Car, whereas someObject as Car
will merely return null if some object is not of type Car or extends Car.
Here's an earlier thread on this same topic, you'll find lots of details in there.