Skip to content

Commit 4636d22

Browse files
committed
Fixed Decorator
1 parent 7872ade commit 4636d22

File tree

6 files changed

+14
-2
lines changed

6 files changed

+14
-2
lines changed

src/StructuralPatterns/AdapterDP/Main.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
public class Main {
44
public static void main(String[] args) {
5-
RectangularPlug plug = new RectangularPlug("rectStem1", "rectStem2");
5+
RectangularPlug plug = new RectangularPlug("leftPlug", "rightPlug");
66
plug.getPower(); // -> "Power power power..."
77
}
88
}

src/StructuralPatterns/DecoratorDP/BasicWindow.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ public class BasicWindow implements Window {
44
public void displayWindow(){
55
System.out.println("Window display");
66
}
7+
78
@Override
89
public String getColor() {
910
return null;

src/StructuralPatterns/DecoratorDP/Decorator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package StructuralPatterns.DecoratorDP;
22

33
public class Decorator implements Window{
4-
protected final Window window;
4+
private final Window window;
55

66
public Decorator(Window window) {
77
this.window = window;

src/StructuralPatterns/Delegator/Child.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,7 @@ public Child(){
88
this.dad = new Dad();
99
this.mom = new Mom();
1010
}
11+
public String getLastName(){
12+
return dad.getLastName();
13+
}
1114
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
package StructuralPatterns.Delegator;
22

33
public class Dad {
4+
private String lastName;
5+
public String getLastName() {
6+
return lastName;
7+
}
48
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
package StructuralPatterns.Delegator;
22

33
public class Mom {
4+
private String lastName;
5+
public String getLastName() {
6+
return lastName;
7+
}
48
}

0 commit comments

Comments
 (0)