auto commit
This commit is contained in:
parent
57a741092b
commit
f89ef4cf59
|
@ -276,6 +276,7 @@ public class ConcreteProduct2 implements Product {
|
||||||
|
|
||||||
```java
|
```java
|
||||||
public class Client {
|
public class Client {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
int type = 1;
|
int type = 1;
|
||||||
Product product;
|
Product product;
|
||||||
|
@ -295,6 +296,7 @@ public class Client {
|
||||||
|
|
||||||
```java
|
```java
|
||||||
public class SimpleFactory {
|
public class SimpleFactory {
|
||||||
|
|
||||||
public Product createProduct(int type) {
|
public Product createProduct(int type) {
|
||||||
if (type == 1) {
|
if (type == 1) {
|
||||||
return new ConcreteProduct1();
|
return new ConcreteProduct1();
|
||||||
|
@ -308,6 +310,7 @@ public class SimpleFactory {
|
||||||
|
|
||||||
```java
|
```java
|
||||||
public class Client {
|
public class Client {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
SimpleFactory simpleFactory = new SimpleFactory();
|
SimpleFactory simpleFactory = new SimpleFactory();
|
||||||
Product product = simpleFactory.createProduct(1);
|
Product product = simpleFactory.createProduct(1);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user