We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 09f5369 commit c7c7e2fCopy full SHA for c7c7e2f
src/main/java/Carnivorous.java
@@ -14,4 +14,9 @@ public boolean eat(BoardMovement sth) {
14
throw new IllegalArgumentException("Carnivorous animals can only eat other animals");
15
}
16
17
+
18
+ @Override
19
+ public boolean canEat(BoardMovement sth) {
20
+ return sth instanceof Herbivorous;
21
+ }
22
src/main/java/Herbivorous.java
throw new IllegalArgumentException("Herbivorous animals can only eat plants");
+ return sth instanceof Plant;
0 commit comments