Permalink
Cannot retrieve contributors at this time
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?
4003CMD-polymorphism/README.md
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
23 lines (19 sloc)
1.07 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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. |