add solution - #4457
Conversation
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Your solution is approved as it correctly implements all required functionality. The bite method properly rejects Carnivore targets as specified in the requirements. While the file comment suggests checking target instanceof Herbivore as an alternative approach, both implementations are functionally valid since rejecting Carnivores achieves the stated requirement of preventing bites on other carnivores. The class hierarchy is properly structured, hide sets hidden to true, Animal.alive tracking works correctly, and dead animals are filtered appropriately. No test failures are present, and the implementation meets all checklist criteria.
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
Footnotes
| super(name); | ||
| } | ||
|
|
||
| bite(target) { |
There was a problem hiding this comment.
The bite method should check target instanceof Herbivore instead of target instanceof Carnivore. The requirements state that bite takes a 'herbivore object' and should not work if it's 'another carnivore' - this means it should only work on Herbivores. Checking for Carnivore doesn't properly validate that the target is actually a Herbivore.
No description provided.