01: package animals;
02:
03: public class Dog extends Wolf {
04:
05: String owner;
06:
07: public Dog(String _name, int _color) {
08: super (_name, _color);
09: }
10:
11: public void attack(String catName) {
12: System.out.println("The dog " + name + " (owner is " + owner
13: + ") attacks the cat " + catName);
14: }
15: /*
16: public void attack(Cat cat) {
17: System.out.println("The dog " + name + " (owner is " + owner
18: + ") attacks the cat " + cat.name);
19: cat.enemy = this;
20: }
21: */
22: }
|