[DUG] Object is Object vs Object.Classname = 'Object'

Todd todd.martin.nz at gmail.com
Tue Jan 25 18:48:03 NZDT 2011


Hi Ross

I can think of only one instance where the second form would be 
unavoidable. That is where a unit containing a parent class refers to 
one of its subclasses. In other words, the class design is screwed, but 
the second form sidesteps the compiler error regarding circular referencing.

I have actually seen a situation where a 3rd party library was modified 
so that it referenced a class in the main/calling application. Insane!

If you're looking at something similar, I would suggest you switch to 
the first form and fix the crappy design.

Todd.

> Just as a matter of curiosity really, anyone know if there is any 
> difference in speed for these 2 operations.
>
> if abc is TMyObject then
>
> and
>
> if abc.Classname = 'TMyObject' then
>
> ?
>
>
> _______________________________________________
> NZ Borland Developers Group - Delphi mailing list
> Post: delphi at delphi.org.nz
> Admin: http://delphi.org.nz/mailman/listinfo/delphi
> Unsubscribe: send an email to delphi-request at delphi.org.nz with Subject: unsubscribe

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://listserver.123.net.nz/pipermail/delphi/attachments/20110125/343146b7/attachment.html 


More information about the Delphi mailing list