Hi,
I collect a reference to all my enemies in a List that is made from their base type, MovableObject. Whenever I want to draw them, I get an iterator with the type of MovableObject and iterate over my List to draw each of them. Obviously the draw() method in MovableObject is empty and each enemy type has it's own Draw method.
I have no problem iterating over enemies, since each of them is an MovableObject, the problem lies when I want to call their respective Draw method call. In another words, how can I tell an enemy that is casted to an MovableObject that when I call draw upon you, you have to call your own Draw call, don't call your base's draw call.
Since my understanding of inheritance is not solid, I have some feeling that it lies with pure virtualness and something like it.
Thanks.
EDIT
I do know that I have to cast my enemis to movable object, I just want their draw method to be called upon their respective draw call, not their base on.
I remember a dynamic cast on C++ can do something similar, if not exactly the same.
Try not. Do, or do not. There is no try.