2014-08-23 13:37:42 +03:00
|
|
|
package com.iluwatar;
|
|
|
|
|
2014-08-31 11:31:03 +03:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* Template Method (StealingMethod) defines skeleton for the
|
|
|
|
* algorithm and subclasses (HitAndRunMethod, SubtleMethod)
|
|
|
|
* fill in the blanks.
|
|
|
|
*
|
|
|
|
*/
|
2014-08-23 13:37:42 +03:00
|
|
|
public class App
|
|
|
|
{
|
|
|
|
public static void main( String[] args )
|
|
|
|
{
|
|
|
|
HalflingThief thief = new HalflingThief(new HitAndRunMethod());
|
|
|
|
thief.steal();
|
|
|
|
thief.changeMethod(new SubtleMethod());
|
|
|
|
thief.steal();
|
|
|
|
}
|
|
|
|
}
|