5
For example, let’s say I have a class TConfiguracao
.
Here constructors and destructors attributes
and in some cultures I create several variables of the type Tconfiguracao
conf1 :TConfiguracao;
conf2 :TConfiguracao;
...
conf1 := TConfiguracao.Create();
conf2 := TConfiguracao.Create();
...
At the close of this form I do:
FreeAndNil(conf1);
FreeAndNil(conf2);
It’s working 100%. What I’d like to know is, is there some way to go through all the objects in that class TConfiguracao
and apply a FreeAndNil
without knowing exactly how many variables of this type I created? I know there is a way to go through the components of a form in that way
for i := 0 to Form.ComponentCount - 1 do
begin
if Form.components[i].classtype is TEdit then
begin
//
end;
end;
But objects from other classes I can’t. Is there any way to do this??
This is a class created by you?
– Guill
Yes, the class was created by me.. I did not put it whole to facilitate understanding ...
– Felipe Sachetti