Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
# 4003cem-polymorphism
# grue
Implement the Grue class as shown in the class hierarchy diagram.
Place this code in the npc.h and npc.cpp files.
Remember that as the Grue class inherits from NPC, it will need to implement the virtual encounter method.
Grue's should have a max health of 1000000.
When a Grue encounters a player, that player should be immediately killed.
When a Grue encounters a player, print a message stating that the player "has been eaten by a Grue".
# platypus
Implement the Platypus class as shown in the class hierarchy diagram.
Place this code in the npc.h and npc.cpp files.
Platypodes (platypuses? platypi?) should have a max health of 10.
When a Platypus encounters a player, that player should be healed.
When a Platypus encounters a player, print a message stating that the player has been "cuddled".
# game
Modify the game.cpp so that there is a single vector called creatures which can store both Grues and Platypodes.
Add at least one Grue and one Platypus to this vector.
# encounter
Have the player encounter all the creatures in the creatures vector.