Hello Dear Freepascal users, I'm a newbee to object pascal. I did however program in turbo pascal. The past couple of days I learned that there exist a variety of classes/object systems in freepascal. Now, I already figured out that the generic class generators are that what we are looking for, which means that we will be generating classes.
Now, as far as I understand it, these classes are in a sense 'smart pointers' (yes, I come from a C++ env), and I found some hints at various places that automatic reference counting should be available in object pascal. So I tried a little testprogram to see when the objects instatiated from a class are disposed off. Below is the little program: {$mode objfpc} Type TReferenceCount = Class Public nummerke: Integer; Destructor Destroy; end; Destructor TReferenceCount.Destroy; begin WriteLn('Deallocation'); end; var Test : TReferenceCount; Pest : TReferenceCount; begin Test:=TReferenceCount.Create(); Pest:=Test; Test.nummerke:=100; WriteLn('Nummerke in test is ', Test.nummerke); WriteLn('Nummerke in pest is ', Pest.nummerke); Pest.nummerke:=200; WriteLn('Nummerke in test is ', Test.nummerke); WriteLn('Nummerke in pest is ', Pest.nummerke); Test:=nil; Pest:=nil; end. So, the question now is where I can find documentation on the reference counting mechanism in freepascal ? Any help would be appreciated, Wkr, -- http://werner.yellowcouch.org/
signature.asc
Description: OpenPGP digital signature
_______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal