下面两个方法分别是存钱和取钱的代码
感觉好多代码是重复的,请问如何重构?
```
func (this *Account) Push(money float64, note string) {
var account Account
account.accountType = "收入"
account.money = money
account.note = note
account.balance += account.money
accounts = append(accounts, account)
}
func (this *Account) Pull(money float64, note string) {
var account Account
account.accountType = "支出"
account.money = money
account.note = note
account.balance -= account.money
accounts = append(accounts, account)
}
```
有疑问加站长微信联系(非本文作者)