May I ask what design pattern is this? It is in programmed in Java language. What would be the best way you recommend people to learn design pattern? In your opinion, how important design pattern is? The code snippet is attached below:
interface Window{
public void draw();
}
class Simplewindow implements Window {
public void draw() {
// draw simple window
}
}
abstract class WindowEnhancement implements Window{
protected Window window;
public WindowEnhancement(Window window){
this.window=window;
}
}
class ScrollBarEnhancement extends WindowEnhancement{
public ScrollBarEnhancement(Window window) {
super(window);
}
public void draw() {
drawScrollBars();
window.draw();
{
private void drawScrollBars() {
// draw scroll bars
}
}
class WindowTest{
public static void main(String[] args) {
Window w= new ScrollBarEnhancement(new Simplewindow()); w.draw();
}
}
Thank you for your help.
Aucun commentaire:
Enregistrer un commentaire