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
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to