>>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