Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
The creature that won't die
Message
 
 
À
25/03/2010 11:48:23
Information générale
Forum:
Visual FoxPro
Catégorie:
VFP Compiler for .NET
Divers
Thread ID:
01456123
Message ID:
01457187
Vues:
64
>>The AS operator is unintuitive but neat... implicit cast returning a null if it fails? Though, this sounds more like a try-catch "see if this works" code, instead of having an IsA(toObj, tcClass) function. What happens if you try to cast a twice subclassed timer as a timer, do you still get a reference to the original object?
>>
>>>I'd do a bit more type checking in the first one if it was for production - but even as it stands it is safer than the VFP version...
>>
>>And what's unsafe in it?



>
>(1) You're not checking that toObj is actually an object
>(2) You assume you can access it's BASECLASS' property (the empty object doesn't have that property)

Great point.
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform