vault backup: 2022-06-14 15:53:24

Affected files:
.obsidian/workspace
02. PARA/03. Resources(資源)/Design Pattern.md
attachments/20220614154819_Observer_Pattern.png
This commit is contained in:
2022-06-14 15:53:24 +08:00
parent 08e568d9e5
commit ec871c349f
3 changed files with 12 additions and 5 deletions

View File

@@ -131,3 +131,10 @@ class duckWood : public duck {
![[Pasted image 20220526183019.png]]
這樣做的另一個好處是fly的初始化是動態的只要再多一個`set()` function就可以動態的切換實作也就是說你可以從設定檔來決定你的鴨子要長什麼樣子。
## 觀察者模式Observer Pattern
有一個會產生變動的主角subject與一堆需要觀察變動的「觀察者」。觀察者向主角註冊當主角發生變化的時候發後通知給觀察者。
![[20220614154819_Observer_Pattern.png]]
其中