[fpc-pascal]init a class from another class

Ivan Montes Drslump at btopenworld.com
Mon Oct 8 20:35:11 CEST 2001

Hi all,

I cannot find a solution to a problem I've got programming a
library. I want to initialze a class which is passed as a
parameter to another class method. It looks like this :

tCoDec = CLASS
  constructor init; VIRTUAL;
  destructor done; VIRTUAL;

tmyCoDec = CLASS (tCoDec)
  constructor init; OVERRIDE;
  destructor done; OVERRIDE;

pCodecList = ^tCodecList;
tCodecList = RECORD
  codec :tCoDec;
  next :pCodecList;

tMain = CLASS
  codec_list :pCodecList;
  constructor init;
  destructor done;

  registerCoDec (var cd :tCoDec);

tMain.registerCoDec(var cd:tCoDec);
  cd := "class of cd".init; 

I don't know how to do this or if it's possible. It's the first time I use classes and maybe the first I use OOP at all, so maybe this is completely impossible to do.

Any help will be appreciated, thks so much.
bye, Ivan

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20011008/3b602616/attachment.html>

More information about the fpc-pascal mailing list