Skip to content

Commit

Permalink
ch11: [refactor] return Money instead of Franc or Dollar instance in …
Browse files Browse the repository at this point in the history
…dollar() and franc() factory methods, to remove reference of Dollar and Franc constructor
  • Loading branch information
hatelove committed Jan 7, 2021
1 parent 5d88b5e commit 69f762b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main/java/money/Money.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ public Money(int amount, String currency) {
}

public static Money dollar(int amount) {
return new Dollar(amount, "USD");
return new Money(amount, "USD");
}

static Money franc(int amount) {
return new Franc(amount, "CHF");
return new Money(amount, "CHF");
}

public boolean equals(Object object) {
Expand Down

0 comments on commit 69f762b

Please sign in to comment.