[fpc-pascal] does Advanced Record constructor automatically zero all the memory space of that record?

Dennis Poon dennis at avidsoft.com.hk
Fri Oct 4 14:48:15 CEST 2013



 >You can use either FillChar as you did or use "Self := 
Default(TTest);" (default is a compiler intrinsics that returns a 0 
value of the type >you passed in, e.g. Nil for classes, '' for strings, 
0 for ordinals and for records all fields are set to 0)

How can I make it so that I only do the Self := Default() once in the 
parent class constructor and don't have to repeat it in all its 
descendant class constructor.


I noticed in your example, you have to specify the class name TTest but 
that implies in every descendant class,  I have to replace it with the 
Descendant class name.

Can I do
   self := Default(ClassType) ?
hoping it will return the descendant's class type?

Dennis





-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20131004/5cb4c4ff/attachment.html>


More information about the fpc-pascal mailing list