咁多位大佬sor9ry
其實我唔係唔明singleton同static個分別 (當然深入啲嘅我真係唔識
)
我同時問幾樣野先撈亂哂啲問題
1) 我明singleton係single instance per application個concept
好似羊巴個例子,我要拎first user access time同之後每個user access 個time difference係一定要用singleton 個concept先做到
但如果唔用呢個singleton嘅nature, 我又唔洗custome啲乜,個helper唔洗extend其他class/interface
咁幾時先要用singleton design? 幾時先要用static?
好似我嗰個return inputstring.split(‘x’)[0] 嘅method
係咪放static會好啲? 因為只係一啲tools咁
2) 就係想問multi thread concurrent call呢個function會點?
singleton同static係multithread 情況下係會點?
多謝咁多位解答咗我咁多