[fpc-pascal]Is an object instanciated?
Johann Glaser
Johann.Glaser at gmx.at
Thu Jan 3 18:01:09 CET 2002
Hi!
In my program I have a class:
Type CTest = class
{ ... }
Constructor Create;
End;
This class will be held in a variable:
Var Test : CTest;
The class is generated:
Test := CTest.Create;
But I don't know, _when_ it is generated, because this will be done when
the user selects a menu entry. When the user now again selects the menu
entry, I have to check, wether the variable "Test" already contains a
created class or not.
At the moment I have solved that problem by setting Test to Nil
Test := Nil;
at the beginning of my program and then testing
if Text = Nil then
Test := CTest.Create;
Is there another, more beautiful way to check if a class is already
created?
What can I do if the class "Destroy()"s itself (e.g. if that class would
be an "About" window with an "OK" button which closes the window) but
doesn't tell the main program that it is destroyed?
Thanks
Hansi
More information about the fpc-pascal
mailing list