diff --git a/src/headfirst/designpatterns/prototype/Client.java b/src/headfirst/designpatterns/prototype/Client.java index 847aacdc..9b7962a8 100644 --- a/src/headfirst/designpatterns/prototype/Client.java +++ b/src/headfirst/designpatterns/prototype/Client.java @@ -5,8 +5,8 @@ public static void main(String[] args) { Monster dragon = new Dragon("Dragon", false); // prototype for all Dragons Monster drakon = new Drakon("Drakon", 2, true); // prototype for all Drakons - Monster laconian = makeMonster(drakon, "Laconian"); - Monster ladon = makeMonster(dragon, "Ladon"); + Monster ladon = makeMonsterOperation(dragon, "Ladon"); + Monster laconian = makeMonsterOperation(drakon, "Laconian"); System.out.println(ladon); ladon.spitPoison(); @@ -15,7 +15,7 @@ public static void main(String[] args) { laconian.spitPoison(); } - public static Monster makeMonster(Monster monsterToCopy, String name) { + public static Monster makeMonsterOperation(Monster monsterToCopy, String name) { Monster newMonster = null; try { newMonster = monsterToCopy.copy(); diff --git a/src/headfirst/designpatterns/prototype/Dragon.java b/src/headfirst/designpatterns/prototype/Dragon.java index 788d3476..94ace77c 100644 --- a/src/headfirst/designpatterns/prototype/Dragon.java +++ b/src/headfirst/designpatterns/prototype/Dragon.java @@ -4,6 +4,7 @@ public class Dragon extends Monster { public Dragon(String name, boolean hasWings) { super(name); this.hasWings = hasWings; + this.canBreatheFire = true; } // Each concrete monster could determine how best to clone itself public Monster copy() throws CloneNotSupportedException {