What is the difference between:
Car(someObject).isRacing;
and
(someObject as Car).isRacing;
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.
Link
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With