2
請問我的圖是否正確? 我特別關心PaymentService
和Customer
之間的關係, Payment
,Customer
你對這張圖有什麼看法?
我猜:
class Customer {
private List<Payment> payments;
//..
public boolean pay() {
return PaymentService.pay(this.payments);
// calling the static method of the class PaymentService
}
}
interface Payment {
// knows nothing about Customer
}
class PaymentService {
public static boolean pay (List<ayment> payments) {
// the magic here is return result
}
}
UPD:現在,我注意到,我爲什麼用靜態成員,但不接觸我的問題。
構建支付系統的常用方法是什麼(看起來像一個普通的任務)?
我想FFCustomer應該只有一個帳戶。 僅當FFCustomer存在時才存在帳戶。
其實,雖然我不認爲這是需要的操作。現在,我想把它作爲抽象類來保存需要支付的金額。 –
圖片更新 –
當您更改原始圖時,答案對任何人都沒有意義。沒有人可以從中受益。 –