2015-12-15 57 views
2

請問我的圖是否正確? 我特別關心PaymentServiceCustomer之間的關係, PaymentCustomer你對這張圖有什麼看法?

我猜:

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存在時才存在帳戶。

enter image description here

UPD: enter image description here

回答

1

這是八九不離十。使關聯支付單向。將帳戶屬性設爲關聯結束。一般來說,屬性只能用數據類型來輸入,而不能用類來輸入。您還缺少付款界面中的操作。

+0

其實,雖然我不認爲這是需要的操作。現在,我想把它作爲抽象類來保存需要支付的金額。 –

+0

圖片更新 –

+0

當您更改原始圖時,答案對任何人都沒有意義。沒有人可以從中受益。 –

相關問題