[fpc-pascal] constructor as procvar
Juha Manninen
juha.manninen at phnet.fi
Sat Mar 20 20:05:31 CET 2010
Hi
The essential part is to have virtual constructor like in Florian Klaempfl's
example code:
t_mammal = class
public
constructor create (color : byte); virtual;
end;
and then...
t_pig = class(t_mammal)
public
constructor create (color : byte); override;
end;
t_mammal_class = class of t_mammal;
and later...
function create_mammal(m: t_mammal_class): t_mammal;
begin
result := m.create(...);
end;
Without the virtual constructor it doesn't work.
Juha
More information about the fpc-pascal
mailing list