Hello, I am trying to implement an automatic updating of myclass
I have this
Type
TMyObj = class(TObject)
end;
TMyChildL1_1 = class(TMyObj)
end;
TMyChildL1_2 = class(TMyObj)
end;
TMyChildL2_1 = class(TMyChildL1_1)
end;
TmyChildL2_2 = class(TmyChildL1_2)
end;
...
and so on..
then I have
TMyClassList = class(TClassList)
end;
var
Myclass : TMyClassList;
...
Initialization
MYClass:=TmyClassList.Create;
MyClass.Add(TMyObj);
MyClass.Add(TMyChildL1_1);
MYclass.Add(TMyChildL1_2);
..
finalization
MYClass.Free
end.
All the above works fine, but any new added Tchild requires to be added manually to the list in the code in the inizializations section,
Is there a function that given the “father” (ie here TmyObj) goes trough all the children so that MyClass instance is automatically updated ?
something like (pseudo code)
Loop form TmyObj to childrenlist.count do
MyClass.Add(TchildN)