更改引用为值

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);
  }

逆向于 更改值为引用