I have an old game project, which doesn't use polymorphism. There are enemies of different types, however, they use the same simple_AI class. The code goes IF someAiType THEN do action. I want to use OOP more effectively, but, I part of my problem is going through a list of objects from the same parent, and calling their own functions. I know the virtual keyword means when you call that function, whatever the subparents version is called. However, I do not know how to loop through these for example
enemyai List → Perform subclasses version of virtual function → Repeat through List
I know how to make a subclass, but repeating through children derived from a parent via array confuses me. I know doing if(ID) → do action is bad practise.