2006/7/13, memsom <[EMAIL PROTECTED]>:
Be aware that if you do this, you will lose the ability to pass any class
that descends from the param type. Var params have to be the smae type
exactly. The Delphi compiler will halt on an error if the exact type isn't
used (though, thinking about it, the "Strict var params" switch might
loosen this in Delphi..)

Thank you for the information. I did not know that.

Best advice: Don't use var params for initialization. Either return the
instance of the class - and raise an exception if there is an error, or
use 'out' params, as it makes your intention clearer.

It made me revise my code and I'm able to do what you suggest. This is
a better approach that I usually take, but I took this code from an
example on VirtualTreeView and in order to test quickly I simply took
it like that. Now I'll remake the procedure into a function.

Best regards.

--
Alexandre Leclerc
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to