class BankAccount(balance: Double) { def deposit(...) def withdraw(...) }
我想知道你如何在功能范例中做同等的事情?
class BankAccount(balance: Double) { def deposit(amount: Double): BankAccount def withdraw(amount: Double): BankAccount }