Imagine TElement is a type defined in a module.
During project progress I create all kind of abstract types of TElement.
Now I need to write a GetElement() function for every abstract type. Instead it would be nice and handy if TElement could have a generic GetElementByType() function.
In my project, things are a little different. TElement does also have a field polLinks:TList containing links to other TElement objects.
I want to be able to ask to a TPlayer instance "Which TEnemies do you have (are linked)?"
or "TEnemy, give me a list of all your TBullets."
I can do all this by calling GetElementsByType()
GetElementsByType() will run through the polLinks list of course.
During project progress I create all kind of abstract types of TElement.
Now I need to write a GetElement() function for every abstract type. Instead it would be nice and handy if TElement could have a generic GetElementByType() function.
In my project, things are a little different. TElement does also have a field polLinks:TList containing links to other TElement objects.
I want to be able to ask to a TPlayer instance "Which TEnemies do you have (are linked)?"
or "TEnemy, give me a list of all your TBullets."
I can do all this by calling GetElementsByType()
GetElementsByType() will run through the polLinks list of course.