Skip to content

Commit

Permalink
add code
Browse files Browse the repository at this point in the history
  • Loading branch information
VentureQ committed Jul 10, 2021
1 parent 1da757a commit ad272ea
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
8 changes: 8 additions & 0 deletions code/Design_Pattern/外观模式/Client.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package Design_Pattern.外观模式;

public class Client {
public static void main(String[] args) {
Facade facade = new Facade();
facade.watchMovie();
}
}
11 changes: 11 additions & 0 deletions code/Design_Pattern/外观模式/Facade.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package Design_Pattern.外观模式;

public class Facade {
private SubSystem subSystem = new SubSystem();

public void watchMovie() {
subSystem.turnOnTV();
subSystem.setCD("a movie");
subSystem.startWatching();
}
}
15 changes: 15 additions & 0 deletions code/Design_Pattern/外观模式/SubSystem.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package Design_Pattern.外观模式;

public class SubSystem {
public void turnOnTV() {
System.out.println("turnOnTV()");
}

public void setCD(String cd) {
System.out.println("setCD( " + cd + " )");
}

public void startWatching(){
System.out.println("startWatching()");
}
}

0 comments on commit ad272ea

Please sign in to comment.