Files
java-design-patterns/template-method/src/main/java/com/iluwatar/templatemethod/StealingMethod.java
T
2015-11-01 21:29:13 -05:00

23 lines
516 B
Java

package com.iluwatar.templatemethod;
/**
*
* StealingMethod defines skeleton for the algorithm.
*
*/
public abstract class StealingMethod {
protected abstract String pickTarget();
protected abstract void confuseTarget(String target);
protected abstract void stealTheItem(String target);
public void steal() {
String target = pickTarget();
System.out.println("The target has been chosen as " + target + ".");
confuseTarget(target);
stealTheItem(target);
}
}