You will build on the previous version. Make sure you fixed any errors or problems!
You will modify your program to add a specific Critter: Ant. You will design a (simple) class hierarchy to plan the inheritance. Ant will inherit all data and function members of Critter. In addition, it will have a function Breed() and a member variable Count.
You will need to change your array(s) to contain pointers to Ant. You will not change any other code in your main program.
Breed() will create a new Ant. It will check the value of count. If count equals 3 then when the Ant moves it leaves a new Ant in the cell it left. It will reset count to 0. Will the Breed() function be public or private?
Think through the algorithm(s). Are you missing anything? If not, its time to start coding. I have to ask, you werent coding already, were you? JJ
HINT: You will have new criteria for ending your program. What is it?
NOTE: It may seem pointless to replace Critter with an Ant. There are more critters coming in later modules! We need to make sure it works with a subclass first.
Reviews
There are no reviews yet.