|
How to flatten the hook hierarchy when using Generic Template Class patter
|
Posted: Aug 25, 2008 12:58 AM
|
|
Advertisement
|
Hi everyone,
my professor told me, that it's possible to flatten the hook hierarchy using the Generic Template Class pattern. but how? i can't see...
an implementation of this pattern looks like this:
public class TemplateClass<T extends Hook>{
private T;
public void templateMethod(){
//alg
t.hookMethod();
//alg
}
}
//hook hierarchy
public abstract class Hook{
public abstract void hookMethod();
}
public class HookA extends Hook{
public void hookMethod(){...}
}
public class HookB extends Hook{
public void hookMethod(){...}
}
has anyone any ideas?
thank you in advance stefan
|
|