[fpc-pascal] constructor as procvar

David Emerson dle3ab at angelbase.com
Fri Mar 19 22:40:24 CET 2010


Florian Klaempfl wrote:
> Constructor procvars are indeed not supported but the way to achieve
> what you want is to use class type variables
> 
>   t_mammal_class = class of t_mammal;
> 
>   function find_or_create_animal (color : byte;
>       pass_mammal_type : t_mammal_class) : t_mammal;
> 
>   brown_pig := t_pig (pig_pen.find_or_create_animal (brown, t_pig));

ah, that is exactly what I need. Works perfectly. Thanks much.

~D.




More information about the fpc-pascal mailing list