將參考值修改為值

refactorgram

class Product {
  applyDiscount(arg) {this._price.amount -= arg;}

image/svg+xml

class Product {
  applyDiscount(arg) {
    this._price = new Money(this._price.amount - arg, this._price.currency);
  }

將值修改為參考 的反例