Posted by Matt Green on April 08, 2001 at 21:19:31:
In Reply to: Re: Creature interactions posted by Daniel Longest on April 08, 2001 at 21:04:07:
: The usage of virtual functions will take care of this, you won't need to know the type of the creature, but you can call the appropriate function.
: : The spec says the creatures in the list are just supposed to be specified as generic creatures and the types aren't supposed to be known, but how are they supposed to interact with each other if the exact type of the other isn't known?
Yeah I know, but I don't see how the creatures can interact with each other if they don't know what they are. Like if a grendel moves into a spot with a plant, he's not going to eat the plant. With abstract classes, I don't see a way to ascertain what kind of object is in the square...e.g. is making a virtual function in your creature class called something like isAnimal legal? It seems necessary for helping inter-creature relations.
Post a Followup