How is the memory used within an object in Delphi?

How is the memory used within an object in Delphi?



- Classes are built to create objects and then the objects are allocated in the constructors and used in the methods.

- The objects that are allocated in the constructor should have a releasing point and that is also in the destructor method.

- The process in which, the constructor constructs, and after the work destructor destructs is called converse process.

- The classes can be made to handle the memory properly by using the persistence property after the object that is currently used is being destroyed.

- The example is as follows:

unit My;
interface
uses
Classes;
type
TMy = class
private
fileData : TStringList;
published
Constructor Create(const fileName : string);
Destructor Destroy; override;
procedure PrintFile;
end;
Post your comment