[fpc-devel] Newbie question: how does the compiler know the class type of an object ( the Is operator)

Dennis Poon dennis at avidsoft.com.hk
Thu Aug 21 12:16:08 CEST 2014


I am just curious, what is the instance size of an Tobject?

in many notifyevents, we would test whether an object is actually of a 
certain class by
if Sender is TComponent then
   ...
end;

How does the "is" operator work?  Is the memory space occupied by that 
object reference contain a pointer to a class table?
If that is true, the minimal instance size of an Tobject is 
sizeof(pointer)?

Sorry if my question is dumb.

Dennis
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20140821/d480ff52/attachment.html>


More information about the fpc-devel mailing list