diff --git a/.obsidian/workspace b/.obsidian/workspace index b341c81..a2899d5 100644 --- a/.obsidian/workspace +++ b/.obsidian/workspace @@ -9,7 +9,7 @@ "state": { "type": "markdown", "state": { - "file": "02. PARA/03. Resources(資源)/C++17/lambda.md", + "file": "02. PARA/03. Resources(資源)/Design Pattern.md", "mode": "source", "source": true } @@ -69,7 +69,7 @@ "state": { "type": "backlink", "state": { - "file": "02. PARA/03. Resources(資源)/C++17/lambda.md", + "file": "02. PARA/03. Resources(資源)/Design Pattern.md", "collapseAll": false, "extraContext": false, "sortOrder": "alphabetical", @@ -86,7 +86,7 @@ "state": { "type": "outline", "state": { - "file": "02. PARA/03. Resources(資源)/C++17/lambda.md" + "file": "02. PARA/03. Resources(資源)/Design Pattern.md" } } } @@ -116,6 +116,7 @@ }, "active": "cfe19fa2de06a1e6", "lastOpenFiles": [ + "02. PARA/03. Resources(資源)/Design Pattern.md", "02. PARA/03. Resources(資源)/C++17/lambda.md", "02. PARA/03. Resources(資源)/C++17/C++17.md", "02. PARA/03. Resources(資源)/C++17/以值擷取(captured-by-value).md", @@ -124,7 +125,6 @@ "02. PARA/01. Project(專案)/未命名.md", "02. PARA/01. Project(專案)/008. Sentinel.md", "02. PARA/03. Resources(資源)/99. templates/front matter.md", - "02. PARA/03. Resources(資源)/Obsidian.md", - "attachments/Pasted image 20201206094618.png" + "02. PARA/03. Resources(資源)/Obsidian.md" ] } \ No newline at end of file diff --git a/02. PARA/03. Resources(資源)/Design Pattern.md b/02. PARA/03. Resources(資源)/Design Pattern.md index c758793..643c11a 100644 --- a/02. PARA/03. Resources(資源)/Design Pattern.md +++ b/02. PARA/03. Resources(資源)/Design Pattern.md @@ -131,3 +131,10 @@ class duckWood : public duck { ![[Pasted image 20220526183019.png]] 這樣做的另一個好處是fly的初始化是動態的,只要再多一個`set()` function就可以動態的切換實作,也就是說你可以從設定檔來決定你的鴨子要長什麼樣子。 + + +## 觀察者模式(Observer Pattern ) +有一個會產生變動的主角(subject),與一堆需要觀察變動的「觀察者」。觀察者向主角註冊,當主角發生變化的時候,發後通知給觀察者。 +![[20220614154819_Observer_Pattern.png]] + +其中 \ No newline at end of file diff --git a/attachments/20220614154819_Observer_Pattern.png b/attachments/20220614154819_Observer_Pattern.png new file mode 100644 index 0000000..fe419fc Binary files /dev/null and b/attachments/20220614154819_Observer_Pattern.png differ